Cannot solve symbolically returning a numeric approximation
古いコメントを表示
Hello, I am trying to solve the function shown in the figure below in terms of (k) but I am getting this warnning, the function is attached as an image. now this is how I solved it.

function [k] = Calculatek()
P`=0.5, P = 10000, k should be 75
P = input('Please Enter value of P : ');
Pd = input('Please Enter value of P''' );
K=sym( 'K') % define symbolic function for equation solver
num= (1-K/P)^(2*(P-K+0.5));
den= (1-2*K/P)^(P-2*K+0.5);
fun=Pd-( 1 - (num/den));
Temp=solve(fun);
k= double(Temp);
now I know for a fact that if P = 100000 and p' = 0.5, k should be 250 and if P = 10000 and p' = 0.5 k should be 75.
I am sure Matlab can solve this but I keep on getting this :
>> Calculatek
Please Enter value of P : 100000
Please Enter value of P'0.5
K =
K
Warning: Cannot solve symbolically.
Returning a numeric approximation instead.
> In solve (line 305)
In Calculatek (line 19)
ans =
-263.6242
which I am sure is not correct
what I am doing wrong? can anyone help.
thanks
2 件のコメント
John D'Errico
2015 年 11 月 29 日
編集済み: John D'Errico
2015 年 11 月 29 日
p' is not a valid variable name in MATLAB, so the above code does not run. Regardless, you never actually use the value of p' in that code. Perhaps you intended the first line to be commented out, and you are using Pd as the value of p'.
Ayman El Hajjar
2015 年 11 月 30 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Numeric Solvers についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
