수치해석,Euler's method, Heun's Method,Midpoint,4th order RK method 예제풀이 및 코딩소스
본 자료는 4페이지 의 미리보기를 제공합니다. 이미지를 클릭하여 주세요.
닫기
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
해당 자료는 4페이지 까지만 미리보기를 제공합니다.
4페이지 이후부터 다운로드 후 확인할 수 있습니다.

소개글

수치해석,Euler's method, Heun's Method,Midpoint,4th order RK method 예제풀이 및 코딩소스에 대한 보고서 자료입니다.

목차

Euler's method
Heun's Method
Midpoint
4th order RK method

본문내용

uation:
where v is velocity (m/s), t = time (s), g is the acceleration due to gravity (9.81 m/s2), and m = mass (kg). Solve for the velocity and distance fallen by a 90 kg object with a drag coefficient of 0.225 kg/m. If the initial height is 1 km, determine when in hits the ground. Obtain your solution with (a) Euler's method and (b)the fourth-order RK method.
◎ Approach & Results ◎
◎ Comments ◎
dv/dt 가 주어진 문제에서 v와 s를 구하는 문제이다. v는 s를 시간에 대해 미분하면 얻을 수 있어, s를 구하기 위한 2계 미분방정식으로도 볼 수 있다. 코딩내용에서 알 수 있듯이 주어진 식을 한번 적분해서 s를 구하였다. s가 1000을 넘으면 프로그램을 정지하도록 코딩하였다.
Euler와 RK method를 비교한 결과, v에 대해서는 거의 같은 값을 가지는 것을 확인했지만, s는 상당히 차이가 심하였다. 코드내용을 비교한 결과 정확한 원인은 알 수 없었지만, 첫 번째 iteration에서 s값을 구할 때 v값이 적절하지 못했던 것으로 보인다.
◆ Programing Source
▶▶ Euler's method
#include
#include
double g=9.81, m=90, Cd=0.225;
double dvdt(double v, double t)
{
return g-Cd*v*v/m;
}
double dsdt(double v, double t)
{
return g*t-Cd*v*v*t/m;
}
void main()
{
double t0, h;
double s,v;
t0=0;
h=0.5;
v=0;s=0;
cout << "Use Euler's method to solve following Prob." << "\n" ;
cout << "< dv/dt = g-Cd*v*v/m; >" << "\n" << "\n";
cout << "step size = " << h << "\n";
cout << "--------------------------------" << "\n";
cout <<" "<< "Xn" << "\t" << "v " << "\t" << "s " << "\t"<< "\n";
cout << "--------------------------------" << "\n";
cout <<" "<< t0 << "\t" << v << "\t" << s << "\t" << "\n";
int iter=0;
int i=0;
while (iter<=1000)
{
i++;
iter++;
double t = t0 + i*h;
v = v + dvdt(t, v)*h;
s = s + dsdt (t, v)*h;
if(s>1000)
{
cout <<" "<< t << "\t" << v << "\t" << s <<"\n";
cout << "--------------------------------" << "\n";
return;
}
else
{
cout <<" "<< t << "\t" << v << "\t" << s <<"\n";
}
}
cout << "--------------------------------" << "\n";
}
◆ Programing Source
▶▶ 4th order RK method
#include
#include
double g=9.81, m=90, Cd=0.225;
double dvdt(double v, double t)
{
return g-Cd*v*v/m;
}
double dsdt(double v, double t)
{
return g*t-Cd*v*v*t/m;
}
void main()
{
double t0, h;
double s,v;
t0=0;
h=0.25;
v=0;s=0;
cout << "Use 4th order method to solve following Prob." << "\n" ;
cout << "< dv/dt = g-Cd*v*v/m >" << "\n" << "\n";
cout << "step size = " << h << "\n";
cout << "--------------------------------" << "\n";
cout <<" "<< "Xn" << "\t" << "v " << "\t" << "s " << "\t"<< "\n";
cout << "--------------------------------" << "\n";
cout <<" "<< t0 << "\t" << v << "\t" << s << "\t" << "\n";
int i=0;
int iter=0;
while (iter<=1000)
{
i++;
iter++;
double k1,k2,k3,k4;
double j1,j2,j3,j4;
double t = t0 + (i-1)*h;
k1=h*dvdt(t,v);
k2=h*dvdt(t+h/2,v+k1/2);
k3=h*dvdt(t+h/2,v+k2/2);
k4=h*dvdt(t+h,v+k3);
v=v+(k1+2*k2+2*k3+k4)/6;
j1=h*dsdt(t,v);
j2=h*dsdt(t+h/2,v+j1/2);
j3=h*dsdt(t+h/2,v+j2/2);
j4=h*dsdt(t+h,v+j3);
s=s+(j1+2*j2+2*j3+j4)/6;
if(s>1000)
{
cout <<" "<< t*h<< "\t" << v << "\t" << s <<"\n";
cout << "--------------------------------" << "\n";
return;
}
else
{
cout <<" "<< t*h << "\t" << v << "\t" << s <<"\n";
}
}
cout << "--------------------------------" << "\n";
}
  • 가격1,500
  • 페이지수14페이지
  • 등록일2010.02.02
  • 저작시기2008.3
  • 파일형식한글(hwp)
  • 자료번호#580025
본 자료는 최근 2주간 다운받은 회원이 없습니다.
청소해
다운로드 장바구니