Question: initial _ x = 1 ; initial _ dxdt = 0 ; t _ span = [ 0 5 ] ; [ t , x

initial_x=1;
initial_dxdt=0;
t_span=[05];
[t,x]=ode45(@(t,x) odesecondorder(t,x,1,1,25),t_span,[initial_x initial_dxdt]);% m=1,b=1,k=25
plot(t,x(:,1));
xlabel('t');ylabel('x');
hold on;
[t,x]=ode45(@(t,x) odesecondorder(t,x,1,10,25),t_span,[initial_x initial_dxdt]);%m=1,b=10,k=25 plotted as dashed line
plot(t,x(:,1),'--')
[t,x]=ode45(@(t,x) odesecondorder(t,x,1,11,25),t_span,[initial_x initial_dxdt]);%m=1,b=11,k=25 plot color yellow
plot(t,x(:,1));
hold off;
function dxdt=odesecondorder(t,x,m,b,k)
dxdt_1=x(2);
dxdt_2=-(b*x(2)+k*x(1))/m;
dxdt=[dxdt_1;dxdt_2];
end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!