Jump to content

kerja

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by kerja

  1. well, I've just stuck on the question. I've done something like that: clear all dt= 0.01; t_max=10; i_max=ceil(t_max/dt)+1; y=zeros(1,i_max); x=zeros(1,i_max); y(1)= 0; x(1)= 1; k=0; t=[0.0:dt:(i_max-1)*dt]; for i=1:i_max-1 k1=-x(i)^2+20; l1=y(i); k2=-x(i)^2+dt*l1/2-k+20; l2=y(i)+dt*k1/2; k3=-x(i)^2+dt*l2/2-k+20; l3=y(i)+dt*k2/2; k4=-x(i)^2+dt*l3-k+20; l4=y(i)+dt*k3; y(i+1)=y(i)+(dt/6)*(k1+2*k2+2*k3+k4); x(i+1)=x(i)+(dt/6)*(l1+2*l2+2*l3+l4); end figure(2) plot(t,x,'b','LineWidth',1),xlabel('t / s'),ylabel('x / m') but think that's wrong btw, the exam is opensource based.
  2. Hi, can someone help me with solving this thing? I'm at the exam at the mo, stuck on this one... thank you!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.