My code does not work

조회 수: 1 (최근 30일)
Eda Deniz Soydinc
Eda Deniz Soydinc 2023년 1월 20일
답변: Sulaymon Eshkabilov 2023년 1월 21일
%Input parameters
Tt = 3000; %Kelvin
Pt = 1500; %[kPa]
mfr = 10; %[kg/s]
R = 8.314;
cp = 2;
cv = 2;
v_idex = sqrt(2*9.8*R*Tt);
[T_e, p_e, rho_e] = IdealGas(Tt, pt, v_e, mfr);
Unrecognized function or variable 'pt'.
gamma = cp/cv;
%method of chracteristic calculation
M = zeros(1,100);
T = zeros(1,100);
rho = zeros(1,100);
v = zeros(1,100);
p = zeros(1,100);
%plot M
plot(x, M);
xlabel('x');
ylabel('M');
%plot pressure
plot(x, pt);
xlabel('x');
ylabel('p (kPa)');
%plot Temp
plot(x, T);
xlabel('x');
ylabel('T Kelvin');
%plot density_rho
plot(x, rho);
xlabel('x');
ylabel('rho');
%plot velocity magnitude
plot(x, v_idex )
xlabel('x');
ylabel('velocity magnitude (m/s)');
  댓글 수: 1
Stephen23
Stephen23 2023년 1월 20일
Pt % what you defined
pt % what you used
Note the capitalisation.

댓글을 달려면 로그인하십시오.

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 1월 21일
Note also that there is one more undefined input vars in your function call. v_e is undefined, v_idex is computed from the given variables, R, Tt.
%Input parameters
Tt = 3000; %Kelvin
Pt = 1500; %[kPa]
mfr = 10; %[kg/s]
R = 8.314;
cp = 2;
cv = 2;
v_idex = sqrt(2*9.8*R*Tt); % v_idex is known
[T_e, p_e, rho_e] = IdealGas(Tt, pt, v_e, mfr);
%%% v_e = ?

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by