Single duffing oscillator subjected to a ground motion.

1 view (last 30 days)
I'm tying to solve a duffing oscillator subjected to a ground motion(EOM, m.u'' + c.u' + k.u +k3.u^3 = -m.ag ). It gives an error:
Error using odearguments (line 95)
@(T,U)ODE_FUN(T,U,K,M,C,K3,A) returns a vector of length 2002, but the length of initial conditions vector is 2. The vector returned by @(T,U)ODE_FUN(T,U,K,M,C,K3,A) and the initial conditions vector must have the same number of elements.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in Cntrl (line 47)
[t,u] = ode45(@(t,u) ode_fun(t,u,k,m,c,k3,a),tspan,[u0; v0]);
k = 10;
k3 = 100;
m =0.2533;
c = 0.1592;
u0=0;
v0=0;
a = Ag_elcentro_FAM; %% EQ ground motion
dt=0.01;
tspan = [0:dt:20]';
ode_fun = @(t,u,k,m,c,k3,ag)[u(2);-(k/m)*u(1)-(c/m)*u(2)-(k3/m)*u(1)^3-ag];
[t,u] = ode45(@(t,u) ode_fun(t,u,k,m,c,k3,a),tspan,[u0; v0]);
disp=u(:,1);
vel=u(:,2);

Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!