필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
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

답변 (1개)

Torsten
Torsten 2023년 10월 10일
이동: Torsten 2023년 10월 10일

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by