towndrunk Veteran 119 Posts user info edit post |
the required problem is 2x''+9x=0 x(0)=1 x'(0)=2 he gave us what should be the solution but i cant get it to turn out
system1.m >>edit
%in system1.m f=zeros(2,1); functionf=f(t,x) f=zeros(2,1); f(1)=(2); f(2)=-4.5*x(1);
system2.m >>edit
%in system2.m time=0:0.001:15; time=time'; xo=[1;2] [t,x]=ode45('system1.m',time,x0) plot(t,x(:,1)); xlabel('time,sec'); ylabel('displacement,m'); title('first response simulation')
>>system2
any help?? 2/1/2006 9:25:47 PM |
JonHGuth Suspended 39171 Posts user info edit post |
heres the example, then use the other thread
%system1.m function f=f(t,x) f=zeros(2,1); f(1)=x(2); f(2)=-4.5*x(1)
%this is an executable to simulate vibration %described by system1.m %filename: myluckyday.m %free response simulation time=0:0.01:15; time=time'; x0=[1:2]; %initial condition [t,x]=ode45('system1',time,x0); plot(t,x(:,1)); xlabel('time, sec') ylabel('Displacement, m'); title('First Try') 2/1/2006 9:32:38 PM |