Iam getting an error with the ODE45 function (line 90)and (line 115)?

1 visualización (últimos 30 días)
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);

Respuesta aceptada

Stephan
Stephan el 14 de Abr. de 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 comentarios
MAHMOUD NASSAR
MAHMOUD NASSAR el 14 de Abr. de 2020
thank u , but it still give me the same error
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by