I'm modeling a system mass spring damper and i have aceleration signal with 20200 values. Im testing with the 3 first values (-0.0120 ; -0.015 ; -0.0109) but ode45 is just using the value -0.0120. What can i do to use these 3 values ?
%MODELING NON-INERTIAL SYSTEM OF 2nd ORDER
% M x''(t) + b x'(t)+ k x(t) = f(t)
%acx = a(:,1)';
acx = [-0.0120 ; -0.015 ; -0.0109 ]'; cond.ini = [0 0]; [t, x] = ode45(@daceler, t, cond.ini, [] , acx); plot(t,x); function f = daceler(~,x,acx) f = zeros (2,1); b=0.01; k=0.18; m=0.005; i = length (3); f(1)=x(2); f(2)=-(b/m)*x(2)-(k/m)*x(1)+((1/m)*acx(1:i)); end
Best Answer