I am getting these two errors when i run my code. I rececntly used the code for a different problem with no questions. How can i get it to run.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in quartercar (line 37)
[time, state_values] = ode45(sdot,tspan,IC);
This is my code,
function quartercark1 = 80000; %N/m
k2 = 500000;%N/mm1 = 2500; %kg
m2 = 320; %kgb1 = 350; %Ns/m
b2 = 15020; %Ns/mrd = @(time) 0.15*sin(time)^2;rdprime = @(time) 0.15*sin(2*time);%Initial Conditions
xone0 = 0; vone0 = 0;xtwo0 = 0; vtwo0 = 0;IC = [xone0, vone0, xtwo0, vtwo0];%Time Span
t0 = 0; tf = 10;tspan = [t0,tf];%sdot = g(t,s) state variable
sdot = @(t,s) ... [s(2); (-1/m1)*((k1*(s(1)-s(3))) + (b1*(s(2)-s(4)))); s(4); ((k1*(s(1)-s(3)) + b1*(s(2)-s(4)) -k2*(s(3)-rd) -b2*(s(4)-rdprime))/m2)];
i am guessing the problem is here
%Numerical Intergration
[time, state_values] = ode45(sdot,tspan,IC);xone = state_values(:,1);vone = state_values(:,2);xtwo = state_values(:,3);vtwo = state_values(:,4);%Plots
plot(time,xone)xlabel('time (s)')ylabel('displacement (m)')title('Displacement vs Time')grid onend
Best Answer