Effacer les filtres
Effacer les filtres

I need help computing the pressure gradient at point “i”, using a centered finite difference using a for loop.

1 vue (au cours des 30 derniers jours)
Here is the formula I need to code. I have the code for both p and x but I'm not sure how to compute this formula using the variable i in a for loop. Can I use a matrix that is more than 2x2 or does it have to be 1x'somegivennumber'? Here is the code I have:
x1 = [1e6:20000:5e6];
z = [0:50:10000];
L = 4e6; % in m
D_c = 5000;% in m
D1 = [0:25:5000];
x_o = 1e6; % in m
x_2 = [x_o:20000:5e6];
[x2,D2] = meshgrid(x1,D1); % x2 is the other x values I want to use for x in the bottom of the formula
[x3,z1] = meshgrid(x,z);
Tw_o = 300; % in K
LR_w = 0.004; % in K/m
LR_c = -0.007; % in K/m
pz_0 = 1000; % in mb
D = D_c.*(sin((pi/L).*(x2-x_o)));
T_c = Tw_o-(((LR_w-LR_c).*D)-((LR_c.*D2)));
T_w = Tw_o-((LR_w.*z1));
T_per = T_c-T_w;
g = 9.81;
Rd = 287;
p = pz_0*(((((T_c)-(LR_c.*D2))./(T_c))).^((g)/(Rd*LR_c))); % this array is what I want to use for p in the formula

Réponses (1)

Torsten
Torsten le 10 Oct 2023
Déplacé(e) : Torsten le 10 Oct 2023

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by