Differential Algebraic Equations with vectors

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);

댓글 수: 2

darova
darova 2019년 11월 11일
DO you have originla formulas/equations? Pictures?
Mau
Mau 2019년 11월 12일
Equation.PNG

댓글을 달려면 로그인하십시오.

 채택된 답변

darova
darova 2019년 11월 12일

1 개 추천

Try
f = @(t,u) inv(Z)*(J+p*W*pi*Q)*[u(3) u(4)]' + inv(Z)*(V+p*W*pi*Q)*[u(1) u(2)]';
F = @(t,u) [u(3)
u(4)
f(t,u)];
[t,u] = ode45(F,timespan,IC);

댓글 수: 3

Mau
Mau 2019년 11월 12일
편집: Mau 2019년 11월 12일
Works fine, I appreciate it. But could you please provide some little explanation on your code or point me towards some literature on your strategy. Thank you very much sir.
You want to find h and theta
123.PNG
First row of this system can be re-written as
1233.PNG
So i wrote all this as
u(1) % h(t)
u(2) % theta(t)
u(3) % dh(t)
u(4) % dtheta(t)
And system of diff equations:
du(1) = u(3);
du(2) = u(4);
du(3) = % something that depends on (h,theta,dh,dtheta)
du(4) = % something that depends on (h,theta,dh,dtheta)
See more ode45
Mau
Mau 2019년 11월 12일
Awesome explanation. Much appreciated.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

제품

릴리스

R2018b

질문:

Mau
2019년 11월 11일

댓글:

Mau
2019년 11월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by