interpolate data into ODE using interp1 and ode45 problems.

i have a data, x... data of x is a data taken from sinusoidal graph, plus,on its own time sampling like this...
x =
0 0
-0.0000 -0.0026
-0.0000 -0.0050
-0.0000 -0.0071
-0.0000 -0.0087
-0.0000 -0.0097
0.0000 -0.0100
0.0000 -0.0096
actually, the data is longer, equivalent to its sampling time and period.
let say i want to use that data to ode equation according to its sampling time... the sampling time for x data is t=0:0.1:100.
so, i try using interpolation. the ode equation is 10d2y/dx2 + 1000dy/dx + 2500000y = 250000s^3
so, here, i want to interpolate x data into s.
below are the codes i tried.
function dxdtt = newforced(t1,b,q,x,t,p3)
dxdtt_1 = b(2);
dxdtt_2 = -100*b(2)-250000*b(1)+(25000*(q^3));
dxdtt = [dxdtt_1;dxdtt_2];
p3=x(:,1);
q=interp(t1,p3,t);
tspan=[0:0.1:100];
initial_dxdtt=0;
initial_b=0;
initial_q=x(2,1);
wrapper=@(t1,x1) newforced(t1,b,x,t,q,p3);
[t1,b]=ode45(wrapper,tspan,[initial_b initial_dxdtt],[initial_q]);
there is too many changes ive done, so im bit confuse...
the problem is, i never got the results. all i got is error. and most frequent error is
Operands to the || and && operators must be convertible to logical scalar values.
Error in interp (line 44)
if l < 1 || r < 1 || cutoff <= 0 || cutoff > 1
Error using newforced (line 2)
Not enough input arguments.
Error in odearguments (line 88)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 114)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
any help is greatly appreciated, thanks.

Risposte (0)

Categorie

Scopri di più su Interpolation in Centro assistenza e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by