Filter löschen
Filter löschen

plotting Y1(2t) to get the correct figure instead of Y1(t)

1 Ansicht (letzte 30 Tage)
Guillaume SIBILLE
Guillaume SIBILLE am 17 Sep. 2020
Beantwortet: Ayush Gupta am 9 Okt. 2020
I've been trying to solve the following system of differentiel equations and to plot one of these functions.
The solver works correctly but I have an unusual problem.
I get the correct graph when I plot y1(2*t) (like I did on this code) instead of y1(t), and I don't know why this is the case. I'm pretty sure that the other functions I made (u, ha and h) are correctly set up.
If anyone has a clue, I'd be glad to hear it!
Thanks in advance
%parameter
We = 780
Re = 1145
t_e = 1.05*We^(-2/3)
s_e = sqrt(3*t_e)
v_e = 0.5* sqrt(3/t_e)
b_e = ((sqrt(12)*t_e^1.5)/pi)
%time interval and initial conditions
t_interval = linspace(t_e,10,1000) ;
init_cond = [s_e b_e v_e];
%solution
[t,y] = ode113(@(t,y) odefcn(t,y, We) , t_interval , init_cond);
%plots y1(2t)
plot(t(1:1:end/2),y(2:2:end,1),'b');
loglog(t(1:1:end/2),y(2:2:end,1),'b')
axis([0.1 10 0.5 5])
function dydt = odefcn(t,y, We)
dydt = [ y(3);
((u(y(1),t)-y(3))*(h(y(1),t)))*4/(y(2)*pi);
(((u(y(1),t)-y(3))^2)*h(y(1),t)-2/We)*8/(y(2)^2*pi);];
end

Antworten (1)

Ayush Gupta
Ayush Gupta am 9 Okt. 2020
The code works fine and there is no problem in it. One possible reason for this could be that these equations or functions are being mis-matched or wrong somewhere which is because of the context of the problem might not be understood fully.

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by