Unknown variable complex equation
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
I know all of the values of the equation shown apart from M. How do I go about finding it?
Cp = -6521
gamma = 1.4

採用された回答
Star Strider
2021 年 4 月 15 日
I ahve no idea what ‘Cp’ does here.
Otherwise:
gamma = 1.4;
prat = @(Me,gamma) ((1+(gamma-1)/2.*Me.^2).^(gamma/(gamma-1))) ./ (2*gamma/(gamma+1).*Me.^2 - (gamma-1)/(gamma+1));
Me = fsolve(@(Me)prat(Me,gamma), 10);
produces:
Me =
1.4832
.
10 件のコメント
Karl Zammit
2021 年 4 月 15 日
Thank you. Pardon my ignorance, but what does the 10 stand for?
Star Strider
2021 年 4 月 15 日
As always, my pleasure!
No worries! Every nonllinear optimisation function needs an initial estimate for every parameter it is to solve for. I randomly chose 10 here for that initial estimate.
Karl Zammit
2021 年 4 月 15 日
Also the output is meant to be between 1 and 0. This does not change for different values of pressure ratio. Pressure ratio should be = -0.6521.
This pops up in the comand window - "
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
value of the function tolerance."
Star Strider
2021 年 4 月 15 日
I have no idea how ‘Cp’ enters into this, since that was not stated, it is not part of the expression, and the posted value is
times the intended value. I used the information originally provided.
With appropriate information, perhaps a solution is possible.
Karl Zammit
2021 年 4 月 16 日
Essentially, I need to find the value of M.

Star Strider
2021 年 4 月 16 日
I let the Symbolic Math Toolbox work with this:
syms Me
gamma = sym(1.4);
Cp = sym(-0.6521);
Eqn = Cp == ((1+(((gamma-1)/2).*Me.^2)).^(gamma/(gamma-1))) ./ ((2*gamma/(gamma+1)).*Me.^2 - (gamma-1)/(gamma+1)) ;
Me = solve(Eqn)
Me_vpa = vpa(Me)
abs_Me_vpa = abs(Me_vpa)
to get:
Me_vpa =
0.81165777828426109075260040547338i
1.1975001390442034303327301058217 + 0.99618983123429503559085894760276i
1.1975001390442034303327301058217 - 0.99618983123429503559085894760276i
1.6759020637684055112009161261056 + 2.6390184872797899437928880153373i
1.6759020637684055112009161261056 - 2.6390184872797899437928880153373i
-0.81165777828426109075260040547338i
- 1.1975001390442034303327301058217 - 0.99618983123429503559085894760276i
- 1.1975001390442034303327301058217 + 0.99618983123429503559085894760276i
- 1.6759020637684055112009161261056 - 2.6390184872797899437928880153373i
- 1.6759020637684055112009161261056 + 2.6390184872797899437928880153373i
abs_Me_vpa =
0.81165777828426109075260040547338
1.5576908431603171537631560287157
1.5576908431603171537631560287157
3.1261903818462034878433853976319
3.1261903818462034878433853976319
0.81165777828426109075260040547338
1.5576908431603171537631560287157
1.5576908431603171537631560287157
3.1261903818462034878433853976319
3.1261903818462034878433853976319
I checked the code, and it appears to do what the code in the image does.
The LaTeX version is:

that with the numeric substitutions is:
so it appears to be coded correctly.
Karl Zammit
2021 年 4 月 16 日
Thanks a lot
Star Strider
2021 年 4 月 16 日
As always, my pleasure!
Karl Zammit
2021 年 4 月 19 日
Would oyu by any chance also know the answer to this question please ? ReadTable
Star Strider
2021 年 4 月 19 日
It would appear that Walter Roberson got there first. I will add an Answer if Walter’s does not do what you want.
The problem with your original code to read that file is that it did not account for every column. Consider using this textscan call instead:
dataBuffer = textscan(finputCdCl, repmat('%f',1,7), 'CollectOutput', 1, ... %Read data from file
'Delimiter', '', 'HeaderLines', 12);
I did not test that with that file, however it would likely do what you want. If it does, and if the readtable approach does not work the way you want it to, I will add this as an Answer. Also, if you want to save the columns as separate cell arrays, set 'CollectOutput' to 0. Check to be certain that the 'Delimiter' is correct, since it could be '\t'.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Conversion Between Symbolic and Numeric についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
