program LRcktSeries
real::t,v,i,l,r,h
!defining v=voltage,i=current,r=resistance,l=inductance,t=time
!defining di/dt=f(i,t)
f(i,t)=(v-i*r)/l
print*,"Enter the smallest incriment"
read*,h
open(1,file='lcr.dat',status='unknown')
!assuming initial values as
r=2;l=0.4;v=10;t=0;i=0
!iteration starts and stops at t=100
1 write(1,*)t,i
i=i+h*f(i,t)
t=t+h
if(t<=100) goto 1
end
real::t,v,i,l,r,h
!defining v=voltage,i=current,r=resistance,l=inductance,t=time
!defining di/dt=f(i,t)
f(i,t)=(v-i*r)/l
print*,"Enter the smallest incriment"
read*,h
open(1,file='lcr.dat',status='unknown')
!assuming initial values as
r=2;l=0.4;v=10;t=0;i=0
!iteration starts and stops at t=100
1 write(1,*)t,i
i=i+h*f(i,t)
t=t+h
if(t<=100) goto 1
end
Comments
Post a Comment