Differential Algebraic Equations with vectors
Afficher commentaires plus anciens
Hello Guys,
I am trying to solve the following differential algebraic Equation and I keep find the below errors concerning the model resolution. I tried chancing the intial conditions and the variables and its not working. Kindly assist.
clc; clear all;
%differential equation symbolic resolution
syms h(t) theta(t)
%initial or boundary conditions
starttime = 0; finishtime=100; timesteps = 10;
%the span
timespan = linspace(starttime, finishtime, timesteps);
%initial conditions
IC = [h(0) == 0, theta(0) == 0];
% equation setup
odequation1 = diff(h(t), t, t) == (26*h(t))/25 - (11683563954355*theta(t))/1099511627776;
odequation2 = diff(theta(t), t, t) == (4296857747895619*theta(t))/562949953421312 - (400*h(t))/1043 ;
odequations = [odequation1, odequation2]
% different tools
dsolve(odequations, timespan, IC);
%OR either tools not working
vars = [h(t), theta(t)];
diffeqn = matlabFunction(odequations, vars, {'h', 'theta', 't'});
sol = ode45(diffeqn, timespan, IC);
Matlab output
dsolve
Error using mupadengine/feval (line 187)
Invalid equations.
Error in dsolve>mupadDsolve (line 340)
T = feval(symengine,'symobj::dsolve',sys,x,options);
Error in dsolve (line 194)
sol = mupadDsolve(args, options);
ode45
Warning: Function 'h' not verified to be a valid MATLAB function.
Warning: Function 'theta_Var' not verified to be a valid MATLAB function.
Warning: Function 'h' not verified to be a valid MATLAB function.
Warning: Function 'theta_Var' not verified to be a valid MATLAB function.
Error using sym/diff (line 36)
Second and third argument must either be variables or a variable and a nonnegative integer specifying the number of differentiations.
Error in
symengine>@(h,t,theta)deal([(diff(h(t),t,t)==diff(h(t),t,t))==h(t).*(2.6e1./2.5e1)-theta(t).*1.062613951431103e1,diff(theta(t),t,t)==h(t).*(-3.835091083413231e-1)+theta(t).*7.63275264840434],[h(t),theta(t)],[h,theta,t])
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);
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Utilities for the Solver 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!

