# Solve ODE for variable domain

2 Ansichten (letzte 30 Tage)
EldaEbrithil am 3 Sep. 2020
Kommentiert: Alan Stevens am 3 Sep. 2020
Hi all
is it possible to solve the same ODE system for 3 adiacent different domain? Do i need something like that?
if x>x1&&x<=x2
.
.
.
elseif x>=x2&&x<x3
.
.
.
elseif x>x3
.
.
.
end
how continuity will be preserved?
Thank you for the help
Regards
##### 5 Kommentare3 ältere Kommentare anzeigen3 ältere Kommentare ausblenden
EldaEbrithil am 3 Sep. 2020
f1,f2,f3)
gamma=1.667;
Pt_nozzle=Ynozzle(1);
M_nozzle=Ynozzle(2);
if (x>=0)&&(x<xstartconica)
%p=(Pt_nozzle/(1+((gamma-1)/2)*M_nozzle^2)^(gamma/(gamma-1)))
dPt_nozzledx=-Pt_nozzle*(Perimetro*f1*gamma*M_nozzle^2)/(2*Anozzle*(Pt_nozzle/(1+((gamma-1)/2)*M_nozzle^2)^(gamma/(gamma-1)))*Anozzle);
dM_nozzledx=M_nozzle*((-(1+((gamma-1)/2)*M_nozzle^2)/(1-M_nozzle^2))*(dA_nozzledx/Anozzle)+...
((1+((gamma-1)/2)*M_nozzle^2)/(1-M_nozzle^2))*(gamma*(M_nozzle^2)*f1*Perimetro/(2*Anozzle*(Pt_nozzle/(1+((gamma-1)/2)*M_nozzle^2)^(gamma/(gamma-1)))*Anozzle)));
elseif (x>=xstartconica)&&(x<=xfineconica)
Anozzle= pi*(yc_end-sqrt(raggio_end^2-(x-xc_end)^2))^2;
Perimetro= 2*pi*(yc_end-sqrt(raggio_end^2-(x-xc_end)^2));
dA_nozzledx=(2*pi*(x-xc_end)/(sqrt(raggio_end^2-(x-xc_end)^2)))*(yc_end-sqrt(raggio_end^2-(x-xc_end)^2));
dPt_nozzledx=-Pt_nozzle*(Perimetro*f2*gamma*M_nozzle^2)/(2*Anozzle*(Pt_nozzle/(1+((gamma-1)/2)*M_nozzle^2)^(gamma/(gamma-1)))*Anozzle);
dM_nozzledx=M_nozzle*((-(1+((gamma-1)/2)*M_nozzle^2)/(1-M_nozzle^2))*(dA_nozzledx/Anozzle)+...
((1+((gamma-1)/2)*M_nozzle^2)/(1-M_nozzle^2))*(gamma*(M_nozzle^2)*f2*Perimetro/(2*Anozzle*(Pt_nozzle/(1+((gamma-1)/2)*M_nozzle^2)^(gamma/(gamma-1)))*Anozzle)));
elseif x>xfineconica
dPt_nozzledx=-Pt_nozzle*(Perimetro*f3*gamma*M_nozzle^2)/(2*Anozzle*(Pt_nozzle/(1+((gamma-1)/2)*M_nozzle^2)^(gamma/(gamma-1)))*Anozzle);
dM_nozzledx=M_nozzle*((-(1+((gamma-1)/2)*M_nozzle^2)/(1-M_nozzle^2))*(dA_nozzledx/Anozzle)+...
((1+((gamma-1)/2)*M_nozzle^2)/(1-M_nozzle^2))*(gamma*(M_nozzle^2)*f3*Perimetro/(2*Anozzle*(Pt_nozzle/(1+((gamma-1)/2)*M_nozzle^2)^(gamma/(gamma-1)))*Anozzle)));
end
dYnozzledx=[dPt_nozzledx;dM_nozzledx];
end
i need to subdived the domain because there are 3 different function that described the Section (Anozzle) trend
EldaEbrithil am 3 Sep. 2020
as you can see the central part is a conical section

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Alan Stevens am 3 Sep. 2020
So you would then call your ode with something like:
where xspan = [0 x_final] and Y0 = [Pt0; M0] or similar.
Then
Pt = Y(:,1);
M = Y(:,2);
##### 2 KommentareKeine anzeigenKeine ausblenden
EldaEbrithil am 3 Sep. 2020
Bearbeitet: EldaEbrithil am 3 Sep. 2020
[xSolnozzle,YSolnozzle]=ode23(@(x,Y)nozzlesinglebobb(x,Ynozzle,xstartconica,...
f1,f2,f3),xRangenozzle,Ynozzle);
is it correct?
Alan Stevens am 3 Sep. 2020
Does it work? If it does, great! If not, try the syntax I used

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by