debug
// diff equation
// m*y'' = m*g-c*y-r*y'+u(t)
m=1
g=9.81
r=1
c=15
Tm=6
y0=-4
v0=0
function ft=u(t)
ft=500*sin(t*5*2*%pi)
endfunction
function wf=w(t)
wf=Wm*sin(t*fw*2*%pi)
endfunction
function dz=f(t,y)
dz=[y(2),g-c*y(1)/m-r*y(2)/m+u(t)/m]
endfunction
z0=[y0;v0];t0=0;t=0:Tm/1000:Tm;
y=ode(z0,t0,t,f)
y1=y(1,:)
plot(t,y1)
// diff equation
// m*y'' = m*g-c*y-r*y'+u(t)
m=1
g=9.81
r=1
c=15
Tm=6
y0=-4
v0=0
function ft=u(t)
ft=500*sin(t*5*2*%pi)
endfunction
function wf=w(t)
wf=Wm*sin(t*fw*2*%pi)
endfunction
function dz=f(t,y)
dz=[y(2),g-c*y(1)/m-r*y(2)/m+u(t)/m]
endfunction
z0=[y0;v0];t0=0;t=0:Tm/1000:Tm;
y=ode(z0,t0,t,f)
y1=y(1,:)
plot(t,y1)
No comments:
Post a Comment