Iam getting an error with the ODE45 function (line 90)and (line 115)?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
MAHMOUD NASSAR
am 14 Apr. 2020
Kommentiert: Stephan
am 16 Apr. 2020
function v=f(t,x)
k=120000 ; %The stiffnes value of structure N/s
c=1000 ; %The damping value of structure kg/s
m=1000 ; %The total massa of structure kg
Fo=150;
w=5;
v=[x(2);x(2)*-(k/m) + x(2)*-(c/m) + Fo/m *cos(w*t)];% the equat?on of motion of the single degree
%of freedome under the harmonic load ( Fo.cos(wt)).
end
and ...
clc
clear
y0=[0,01 0,5]; %enter the initial conditions.
t0=[0 60] ; %enter the first and final time for the analysis.
[t,x]=ode45('f',t0,y0);
plot (t,x(:,1))%plot the results.
ERRORS:
Undefined function or variable 'v'.
Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
0 Kommentare
Akzeptierte Antwort
Stephan
am 14 Apr. 2020
clc
clear
y0=[0.01 0.5]; %enter the initial conditions.
t0=[0 60] ; %enter the first and final time for the analysis.
[t,x]=ode45(@f,t0,y0);
plot (t,x(:,1))%plot the results.
function v=f(t,x)
k=120000 ; %The stiffnes value of structure N/s
c=1000 ; %The damping value of structure kg/s
m=1000 ; %The total massa of structure kg
Fo=150;
w=5;
v=[x(2);x(2)*-(k/m) + x(2)*-(c/m) + Fo/m *cos(w*t)];% the equat?on of motion of the single degree
%of freedome under the harmonic load ( Fo.cos(wt)).
end
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!