How to code a couple ODE with nodes
Ältere Kommentare anzeigen
Hello everyone. I am trying to model a thermal system. It is a system of the equation that must be solved:

Xi and Yi are the temperatures at a hypothetical element. (i-1) and (i+1) refer to the previous and next node and A to G are some known coefficients. I consider the ode45 to solve these coupled equations, but the problem is with defining a new parameter such as Z to involve both X and Y, how the nodes (i-1 i i+1) be considered?
Can the following code be run with a few changes?
function zprime = myfun(t,z);
zprime=[A*x(1)(i) + B*x(1)(i-1) + C*x(1)(i+1) + D*x(2)(i) ; E*x(2)(i) + F*x(2)(i-1) + G*x(1)(i)]; % This is absoloutly wrong call!
z0=[a b];
tspan=[0,20];
[t,x]=ode45(@myfun,tspan,z0);
Many thanks!
Akzeptierte Antwort
Weitere Antworten (1)
ehsan rezaei
am 5 Feb. 2022
0 Stimmen
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!