Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Trying to solve for P in the equation. Been told fzero does not give correct solution.

2 ビュー (過去 30 日間)
Skye Cameron
Skye Cameron 2020 年 2 月 17 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
%clc; clear; close all; format short g;
%knowns
gamma = 1.66;
R = 8.314;
m = 4.0e-3;
RoM = R/m;
P0 = 10e5;
T0 = 300;
r0 = 0.01;
L = 0.05;
rho0 = P0/(RoM*T0);
%function for area
x = [0:0.001:2*L];
func = @(x) r0*((2*x./L)+ exp(-2*x./L));
y = func(x);
plot(x,y);
At = pi*r0*r0;
% equations
mc = At*(sqrt(gamma*P0*rho0))*(2/(gamma+1))^((gamma+1)/(2*(gamma-1))); %mass flux choking
%solving for P
f = @(P) ((P/P0)^(2/gamma)) - ((P/P0)^(1+(1/gamma))) == ((gamma-1)/(2*gamma))*((mc^2)/((At^2)*P0*rho0));
r = solve (f,eps)
  1 件のコメント
dpb
dpb 2020 年 2 月 17 日
Is there a specific Q? here?
Have you plotted the function to investigate behavoir???

回答 (1 件)

Samatha Aleti
Samatha Aleti 2020 年 2 月 26 日
Hi,
I think you need to specify the variables as “sym” to use “solve”. You may also solve for “P” using “fsolve function.
Here is the documentation link for “fsolve”.
  4 件のコメント
Walter Roberson
Walter Roberson 2020 年 2 月 26 日
If you convert everything to rational, except using the transcendentatal pi instead of an approximation of it, then 281250*sqrt(3) becomes an exact solution. That is approximately 487139.2898.
dpb
dpb 2020 年 2 月 28 日
Ah, indeed! I hadn't really looked at the algebra, just the numerical solution. Nicely done, Walter!

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by