본문내용
(3,i)
call dots(tn+h,xn,f)
do 50 i=1,n
50 k(4,i)=h*f(i)
do 60 i=1,n
sk=k(1,i)+2*k(2,i)+2*k(3,i)+k(4,i)
60 xn(i)=tx(i)+sk/6
do 70 i=1,n
70 tx(i)=xn(i)
80 tn=tn+h
return
end
subroutine dots(t,x,f)
real x(10),f(10)
f(1)=x(2)
f(2)=x(3)
f(3)=t+2*x(1)+t*f(1)-t*f(2)
return
end
data : 03xypq
0.0 0.6 0.2 .0001
0.0 1.0 0.0
결과
x-value y-value y-deriv p-value p-deriv q-value q-deriv
0.000 0.0000 1.0000 1.0000 0.0000 0.0000 0.0000
0.200 0.2003 1.0053 1.0053 0.0793 0.0793 0.7857
0.400 0.4042 1.0418 1.0418 0.3095 0.3095 1.5013
0.600 0.6210 1.1380 1.1380 0.6733 0.6733 2.1208
8.15
subroutine dots(t,x,f)
real x(10),f(10)
real k,m
f(1)=x(2)
f(2)=16*cos(8*t)-64*x(1)
return
end
결과
t-value x-value x-deriv p-value p-deriv
0.000 0.0000 0.0000 0.0000 16.0000
0.200 0.1999 0.9529 0.9529 -13.2617
0.400 -0.0233 -3.2529 -3.2529 -14.4786
0.600 -0.5977 -0.5762 -0.5762 39.6522
0.800 0.0932 6.4729 6.4729 9.9240
1.000 0.9894 -0.1746 -0.1746 -65.6465
8.17
c simulataneous differential equations
c solving with modified euler method
external fxp,fyp
open(6,file='bnd17.out',status='old')
c (tl,tu): independent variable bounary value
c (xl,xu): dependent variable initial value
c (ch1,ch2):asumed derivertive value
c h interval increment value
c fxp:function subroutine supplid by user dx/dt=y
c fyp:function subroutine supplied by user dy/dt
tl=0
tu=1.
xl=0
xu=1.9
ch1=1.
ch2=1.50
h=0.1
y0=ch1
r=xu
t0=tl
x0=xl
y0=ch1
tol=0.000001
call euler(t0,tu,h,x0,y0,fxp,fyp,r1,tol)
dch=100
drr=100
while(dch.gt.tol.and.drr.gt.tol) do
t0=tl
x0=xl
y0=ch2
call euler(t0,tu,h,x0,y0,fxp,fyp,r2,tol)
ch= ch1+(ch2-ch1)/(r2-r1)*(r-r1)
ch1=ch2
ch2=ch
dch=abs(ch1-ch2)
drr=abs(r1-r2)
r1=r2
endwhile
stop
end
subroutine euler(t0,tl, h,x0,y0,fxp,fyp,xc,tol)
write(*,15)
15 format(9x,'x',9x,'y',9x,'p')
write(*,25)t0,x0,y0
while(t0.le.tl)do
25 format(5x,6f10.4)
t1=t0+h
xdot=fxp(t0,x0,y0)
ydot=fyp(t0,x0,y0)
xp=x0+h*xdot
yp=y0+h*ydot
dx=10.
dy=10.
while(dx.gt.tol.and.dy.gt.tol)do
xc=x0+(xdot+fxp(t1,xp,yp))*h/2.
yc=y0+(ydot+fyp(t1,xp,yp))*h/2.
dx=abs(xc-xp)
dy=abs(yc-yp)
xp=xc
yp=yc
endwhile
t0=t1
x0=xc
y0=yc
write(*,25)t0,x0,y0
endwhile
return
end
function fxp(x,y,p)
fxp=p
return
end
function fyp(x,y,p)
fyp=4.2*x+ 3*y-x*p
return
end
x y y'
0.0000 0.0000 1.0000
0.1000 0.1000 1.0310
0.2000 0.2077 1.1238
0.3000 0.3279 1.2787
0.4000 0.4666 1.4958
0.5000 0.6301 1.7750
0.6000 0.8247 2.1163
0.7000 1.0565 2.5198
0.8000 1.3318 2.9855
0.9000 1.6567 3.5132
1.0000 2.0375 4.1031
x y y'
0.0000 0.0000 1.5000
0.1000 0.1500 1.5360
0.2000 0.3090 1.6437
0.3000 0.4824 1.8236
0.4000 0.6773 2.0757
0.5000 0.9011 2.4000
0.6000 1.1609 2.7964
0.7000 1.4640 3.2650
0.8000 1.8175 3.8057
0.9000 2.2287 4.4186
1.0000 2.7048 5.1036
x y y'
0.0000 0.0000 0.8970
0.1000 0.0897 0.9269
0.2000 0.1869 1.0166
0.3000 0.2960 1.1664
0.4000 0.4232 1.3763
0.5000 0.5743 1.6462
0.6000 0.7554 1.9762
0.7000 0.9725 2.3663
0.8000 1.2317 2.8164
0.9000 1.5388 3.3267
1.0000 1.9000 3.8969
8.18 답: | y
-----------+--------------
0 | 0
/8 | 0.3851
/4 | 0.7108
3 /8 | 0.9268
/2 | 1
call dots(tn+h,xn,f)
do 50 i=1,n
50 k(4,i)=h*f(i)
do 60 i=1,n
sk=k(1,i)+2*k(2,i)+2*k(3,i)+k(4,i)
60 xn(i)=tx(i)+sk/6
do 70 i=1,n
70 tx(i)=xn(i)
80 tn=tn+h
return
end
subroutine dots(t,x,f)
real x(10),f(10)
f(1)=x(2)
f(2)=x(3)
f(3)=t+2*x(1)+t*f(1)-t*f(2)
return
end
data : 03xypq
0.0 0.6 0.2 .0001
0.0 1.0 0.0
결과
x-value y-value y-deriv p-value p-deriv q-value q-deriv
0.000 0.0000 1.0000 1.0000 0.0000 0.0000 0.0000
0.200 0.2003 1.0053 1.0053 0.0793 0.0793 0.7857
0.400 0.4042 1.0418 1.0418 0.3095 0.3095 1.5013
0.600 0.6210 1.1380 1.1380 0.6733 0.6733 2.1208
8.15
subroutine dots(t,x,f)
real x(10),f(10)
real k,m
f(1)=x(2)
f(2)=16*cos(8*t)-64*x(1)
return
end
결과
t-value x-value x-deriv p-value p-deriv
0.000 0.0000 0.0000 0.0000 16.0000
0.200 0.1999 0.9529 0.9529 -13.2617
0.400 -0.0233 -3.2529 -3.2529 -14.4786
0.600 -0.5977 -0.5762 -0.5762 39.6522
0.800 0.0932 6.4729 6.4729 9.9240
1.000 0.9894 -0.1746 -0.1746 -65.6465
8.17
c simulataneous differential equations
c solving with modified euler method
external fxp,fyp
open(6,file='bnd17.out',status='old')
c (tl,tu): independent variable bounary value
c (xl,xu): dependent variable initial value
c (ch1,ch2):asumed derivertive value
c h interval increment value
c fxp:function subroutine supplid by user dx/dt=y
c fyp:function subroutine supplied by user dy/dt
tl=0
tu=1.
xl=0
xu=1.9
ch1=1.
ch2=1.50
h=0.1
y0=ch1
r=xu
t0=tl
x0=xl
y0=ch1
tol=0.000001
call euler(t0,tu,h,x0,y0,fxp,fyp,r1,tol)
dch=100
drr=100
while(dch.gt.tol.and.drr.gt.tol) do
t0=tl
x0=xl
y0=ch2
call euler(t0,tu,h,x0,y0,fxp,fyp,r2,tol)
ch= ch1+(ch2-ch1)/(r2-r1)*(r-r1)
ch1=ch2
ch2=ch
dch=abs(ch1-ch2)
drr=abs(r1-r2)
r1=r2
endwhile
stop
end
subroutine euler(t0,tl, h,x0,y0,fxp,fyp,xc,tol)
write(*,15)
15 format(9x,'x',9x,'y',9x,'p')
write(*,25)t0,x0,y0
while(t0.le.tl)do
25 format(5x,6f10.4)
t1=t0+h
xdot=fxp(t0,x0,y0)
ydot=fyp(t0,x0,y0)
xp=x0+h*xdot
yp=y0+h*ydot
dx=10.
dy=10.
while(dx.gt.tol.and.dy.gt.tol)do
xc=x0+(xdot+fxp(t1,xp,yp))*h/2.
yc=y0+(ydot+fyp(t1,xp,yp))*h/2.
dx=abs(xc-xp)
dy=abs(yc-yp)
xp=xc
yp=yc
endwhile
t0=t1
x0=xc
y0=yc
write(*,25)t0,x0,y0
endwhile
return
end
function fxp(x,y,p)
fxp=p
return
end
function fyp(x,y,p)
fyp=4.2*x+ 3*y-x*p
return
end
x y y'
0.0000 0.0000 1.0000
0.1000 0.1000 1.0310
0.2000 0.2077 1.1238
0.3000 0.3279 1.2787
0.4000 0.4666 1.4958
0.5000 0.6301 1.7750
0.6000 0.8247 2.1163
0.7000 1.0565 2.5198
0.8000 1.3318 2.9855
0.9000 1.6567 3.5132
1.0000 2.0375 4.1031
x y y'
0.0000 0.0000 1.5000
0.1000 0.1500 1.5360
0.2000 0.3090 1.6437
0.3000 0.4824 1.8236
0.4000 0.6773 2.0757
0.5000 0.9011 2.4000
0.6000 1.1609 2.7964
0.7000 1.4640 3.2650
0.8000 1.8175 3.8057
0.9000 2.2287 4.4186
1.0000 2.7048 5.1036
x y y'
0.0000 0.0000 0.8970
0.1000 0.0897 0.9269
0.2000 0.1869 1.0166
0.3000 0.2960 1.1664
0.4000 0.4232 1.3763
0.5000 0.5743 1.6462
0.6000 0.7554 1.9762
0.7000 0.9725 2.3663
0.8000 1.2317 2.8164
0.9000 1.5388 3.3267
1.0000 1.9000 3.8969
8.18 답: | y
-----------+--------------
0 | 0
/8 | 0.3851
/4 | 0.7108
3 /8 | 0.9268
/2 | 1
추천자료
딜라토미터 실험
이분법, (수정)선형보간법, 고정점 반복법, Newton법, secant법, Muller법, Bairstow법
Gauss-Seidel 법 , Gauss-Seidel 을 이용한 해를 찾는 소스.
매트랩(MATLAB)을 이용한 FM변조 및 복조 신호 나타내어 파형 비교하기
NATM공법 터널 설계
모터제어 실험 예비보고서
임계 좌굴하중 실험
[공식][수학][물리학][공학][열역학][블랙숄즈]고등수학의 공식, 물리학의 공식과 단위, 열역...
광 온도 측정(예비)
열유체 (실생활)
동적시스템 및 제어공학 - 모터제어의 기본 이론과 실험
[공기조화][공기조화 설비][공기조화기][자동제어장치][공기여과기][공기조화분야][냉동공학]...
[파동, 파동 정의, 파동 발생과 종류, 파동 성질, 파동 현상, 파동 에너지, 파동 방정식, 파...
[시험보고서] 인장시험 - KS 10호 시험편.ppt
소개글