solving differential equations with ode 45
Afficher commentaires plus anciens
Hi everyone,
I have a little problem using ode45 to solve this equation
with initial conditions
. But every time i try to run my script, i get this message of error
Error in Ryelandt_288861_Assignment2>@(t,z)EX_3_ode(z,t,M(1),c,c3,J)
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);
Error in Ryelandt_288861_Assignment2 (line 33)
[t_out1,Z_out1] = ode45( @(t,z) EX_3_ode(z,t,M(1),c,c3,J), xx, IC1, opts);
Could someone help me with this ?
%% Initiate the script
clc; clear; close all
xx = linspace(0,10,1e3).';
%% Define the parameters
Ct= 200; %[J/K]
ht=140; %[W/m^2K]
At=0.02; %[m^2]
he=200; %[W/m^2K]
Ae=pi; %[m^2]
Te= 298; %[K]
V=6*pi; %[m^3]
rho=1; %[kg/m^3]
cp=4200; %[J/kgK]
J=300; %[kgm^2]
c=2; %[Nms]
c3=0.1; %[Nms^3]
cq=0.09; %[Ws^4]
M=[5,15,20,25,55]; %[Nm]
%% Question 3
%initial conditions
IC1=[0; 0];
opts= odeset('RelTol',1e-8,'AbsTol',1e-10);
[t_out1,Z_out1] = ode45( @(t,z) EX_3_ode(z,t,M(1),c,c3,J), xx, IC1, opts);
%% Function definition
function dzdt1 = EX_3_ode(z,M,c,c3,J)
dzdt1(1,1) = z(2) ;
dzdt1(2,1) =(M-c.*z(2)-c3.*z(2)^3)./J ;
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!