Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Error in solving ode using symbolic calculations

3 Ansichten (letzte 30 Tage)
Roman Gilgor
Roman Gilgor am 1 Mär. 2020
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
hi, I am trying to compare my solution using ode45 and runge kutta to analytical solution of symbolic matlab.
Iam solving a simple system of linear ode equations: (this is the code)
syms s1(t) s2(t) I(t) u(t)
u(t) = 10; % input
% system of odes
ode1 = diff(s1) == u(t) - s1/55; % equation 1
ode2 = diff(s2) == s1/55 - s2/55; % equation 2
ode3 = diff(I) == s2/(0.12*55*60) - 0.138*I; % equation 3
odes = [ode1; ode2; ode3];
%initial conditions
cond1 = s1(0) == 0;
cond2 = s2(0) == 0;
cond3 = I(0) == 0;
conds = [cond1; cond2; cond3];
[s1Sol(t), s2Sol(t),Isol(t)] = dsolve(odes,conds)
I would like to see what Isol(t) is equal to. Every time I change the numbers at equation 2 or 3 it changes the solution of only equation 1! why????
I solved this analyticly on papper and its definetly wrong.
both ode45 and runge kutta gives me the same answer but for some reason analytical matlab solution is wrong.
Please help.
Thanks allot!!!
by the way this is ode45 function
% initial conditions are 0 0 0
% time interval 0 - 10
function dydt = odefun(t,y)
dydt = zeros(3,1);
dydt(1) = 10 - y(1)/55;
dydt(2) = y(1)/55 - y(2)/55;
dydt(3) = y(2)/(55*0.12*B60) - 0.138*y(3);
end
  2 Kommentare
darova
darova am 1 Mär. 2020
What is this?
Roman Gilgor
Roman Gilgor am 1 Mär. 2020
Bearbeitet: Roman Gilgor am 1 Mär. 2020
Hi, avoid this ita my mistake in copying it from matlab. It just 0.12*60 Thanks!

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by