MATLAB Answers

Single duffing oscillator subjected to a ground motion.

2 ビュー (過去 30 日間)
Ismail Amara
Ismail Amara 2020 年 2 月 8 日
I'm tying to solve a duffing oscillator subjected to a ground motion(EOM, m.u'' + c.u' + k.u +k3.u^3 = ). 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;
a = Ag_elcentro_FAM; %% EQ ground motion
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]);

回答 (0 件)


Community Treasure Hunt

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

Start Hunting!

Translated by