Solving system of equations
Afficher commentaires plus anciens
Hi all
i have a question about solving this system of equations. Tt, Pt and M are related to space and time due to i and j; i want to solve the system maintaining that dependence, so the result will be a matrix respectively for Tt, Pt and M. When i try to solve, i obtain "Out of range subscript." error. gamma, deltax and deltat are constant
Thanks to all
Tt=zeros(length(x),length(t));
Pt=zeros(length(x),length(t));
M=zeros(length(x),length(t));
Tt(1,1)=3.000555630247608e+02;
Pt(1,1)=2.201018491400215e+05;
M(1,1)=0.023565919700319;
for j=1:length(t)-1
for i=2:length(x)-1
Alla = cell(length(x),length(t));
Allb = cell(length(x),length(t));
Allc = cell(length(x),length(t));
syms Tt Pt M
[sola,solb,solc]=vpasolve(Tt(i,j+1)==0.5*(Tt(i+1,j)-Tt(i-1,j))+((1+((gamma-1)/2)*M(i,j)^2)^(gamma/(gamma-1)))*((Tt(i+1,j)-Tt(i-1,j))*deltat/(2*deltax))+((1+((gamma-1)/2)*M(i,j)^2))*((Pt(i+1,j)-Pt(i-1,j))*deltat/(2*deltax)),...
Pt(i,j+1)==0.5*(Pt(i+1,j)-Pt(i-1,j))+2*((1+((gamma-1)/2)*M(i,j)^2)^(gamma/(gamma-1)))*((Tt(i+1,j)-Tt(i-1,j))*deltat/(2*deltax))+3*((1+((gamma-1)/2)*M(i,j)^2))*((Pt(i+1,j)-Pt(i-1,j))*deltat/(2*deltax)),...
M(i,j+1)==0.5*(M(i+1,j)-M(i-1,j))+2*((1+((gamma-1)/2)*M(i,j)^2)^(gamma/(gamma-1)))*((Tt(i+1,j)-Tt(i-1,j))*deltat/(2*deltax))+3*((1+((gamma-1)/2)*M(i,j)^2))*((Pt(i+1,j)-Pt(i-1,j))*deltat/(2*deltax)));
Alla{i,j} = sola;
Allb{i,j} = solb;
Allc{i,j} = solc;
end
end
17 commentaires
darova
le 27 Mai 2020
- "Out of range subscript." error. gamma, deltax and deltat are constant
I don't see these variable are defined. Did you define them somewhere?
EldaEbrithil
le 27 Mai 2020
darova
le 27 Mai 2020
What is going on here?

- are variable Tt Pt M numerical or symbolic?
EldaEbrithil
le 27 Mai 2020
EldaEbrithil
le 27 Mai 2020
darova
le 27 Mai 2020
I'm confused. What variable are changing and variable you want to find?
EldaEbrithil
le 27 Mai 2020
darova
le 27 Mai 2020
Can you show original equations? If you have 3 equations you can get only 3 solutions
EldaEbrithil
le 27 Mai 2020
darova
le 27 Mai 2020
You have system of PDE (partial differential equations). Do know what does it mean?
EldaEbrithil
le 27 Mai 2020
darova
le 27 Mai 2020
What about FDM(finite difference method)?
EldaEbrithil
le 27 Mai 2020
darova
le 27 Mai 2020
EldaEbrithil
le 27 Mai 2020
darova
le 27 Mai 2020
I can't explain it here
you what i mean?
Read about this method. Read about "Method of lines"
EldaEbrithil
le 28 Mai 2020
Réponses (1)
darova
le 28 Mai 2020
0 votes
Here is a simple example. I hope it's clear enough. TR, TL, TD - boundary conditions (right, left and down boundaries)

2 commentaires
EldaEbrithil
le 30 Mai 2020
darova
le 30 Mai 2020
I can't check it. It's too complicated, sorry
Catégories
En savoir plus sur Eigenvalue Problems dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!