Loop of two variables

1 回表示 (過去 30 日間)
Abdulrahman Mohamed
Abdulrahman Mohamed 2022 年 6 月 15 日
回答済み: KSSV 2022 年 6 月 15 日
I want to measure effect of pressure and temprature on Density so
-I want to calculate first the effect of pressure on density at fixed temprature (for example density values for pressure ranges from 100 to 1000 psia at 60 F)
  • Then I want to repeate the same but at other temprature
Example of code
A=100
P=100:1000
Pc=1076
Tc=400
T=100:1000 %
for i =1:length(100)
pr(i)=(P(i)/Pc) %function of pressure
tr= T/Tc % this parameter function on temp
p=(pr(i)+tr;
This code run correctly if T= one value
but i want to repeat the same but at Temprature range from 100:1000

回答 (1 件)

KSSV
KSSV 2022 年 6 月 15 日
A=100 ;
P=100:1000 ;
Pc=1076 ;
Tc=400 ;
T=100:1000 ;%
[P,T] = meshgrid(P,T) ;
pr = P/Pc ;
tr = T/Tc ;
p = pr+tr ;
surf(P,T,p)
shading interp

カテゴリ

Help Center および File ExchangeAgriculture についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by