My code does not work

1 view (last 30 days)
Eda Deniz Soydinc
Eda Deniz Soydinc on 20 Jan 2023
%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 Comment
Stephen23
Stephen23 on 20 Jan 2023
Pt % what you defined
pt % what you used
Note the capitalisation.

Sign in to comment.

Answers (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 21 Jan 2023
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 = ?

Tags

Community Treasure Hunt

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

Start Hunting!