How to solve a function with symbolic tool
1 回表示 (過去 30 日間)
古いコメントを表示
I want to solve a function with symbolic math toolbox. The equation is quite simple but I can't solve it for the variale I want by hand. It should contain two function handles and one of them contain the variable I want to solve for. Here is the code:
gamma = 1.4;
M0 = 1.5;
PhiD = 0.93;
ed=0.9298;
fM =@ (M) (sqrt(gamma).*M)./(1+0.5*(gamma-1).*M^2)^((gamma+1)/(2*(gamma-1)));
syms M
f = ed*(fM(M)/fM(M0))-PhiD;
Mi=solve(f,M)
Last command returns a 1x1 sym variable and the command window displays : Mi =
root(487667696955747081*5^(1/2)*7^(1/2)*z^6 + 7315015454336206215*5^(1/2)*7^(1/2)*z^4 + 36575077271681031075*5^(1/2)*7^(1/2)*z^2 - 732792583293936200000*z + 60958462119468385125*5^(1/2)*7^(1/2), z, 1)
root(487667696955747081*5^(1/2)*7^(1/2)*z^6 + 7315015454336206215*5^(1/2)*7^(1/2)*z^4 + 36575077271681031075*5^(1/2)*7^(1/2)*z^2 - 732792583293936200000*z + 60958462119468385125*5^(1/2)*7^(1/2), z, 2)
root(487667696955747081*5^(1/2)*7^(1/2)*z^6 + 7315015454336206215*5^(1/2)*7^(1/2)*z^4 + 36575077271681031075*5^(1/2)*7^(1/2)*z^2 - 732792583293936200000*z + 60958462119468385125*5^(1/2)*7^(1/2), z, 3)
root(487667696955747081*5^(1/2)*7^(1/2)*z^6 + 7315015454336206215*5^(1/2)*7^(1/2)*z^4 + 36575077271681031075*5^(1/2)*7^(1/2)*z^2 - 732792583293936200000*z + 60958462119468385125*5^(1/2)*7^(1/2), z, 4)
root(487667696955747081*5^(1/2)*7^(1/2)*z^6 + 7315015454336206215*5^(1/2)*7^(1/2)*z^4 + 36575077271681031075*5^(1/2)*7^(1/2)*z^2 - 732792583293936200000*z + 60958462119468385125*5^(1/2)*7^(1/2), z, 5)
root(487667696955747081*5^(1/2)*7^(1/2)*z^6 + 7315015454336206215*5^(1/2)*7^(1/2)*z^4 + 36575077271681031075*5^(1/2)*7^(1/2)*z^2 - 732792583293936200000*z + 60958462119468385125*5^(1/2)*7^(1/2), z, 6)
But Mi should be a number. How can I fix it ?
0 件のコメント
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!