solve function results come as function not numbers

I'm trying to solve an equation using solve functuion and it did solve it correctly but the output resulrs comes as a function not numbers the code is below
clc
clear all
close all
syms n
p=4;
v=230;
R=0.2;
f=input('f = ')
Ns=120*f/p;
s=(Ns-n)/Ns;
VLL=v*sqrt(3);
Pg=3*v^2*s/R;
Pd=Pg*(1-s);
Po=10.5*1000*(n/1800)^3;
eqn=Pd-Po;
S=solve(eqn,n);
n= S(S>0);
P_out=Po/1000;
R=[f VLL n P_out]
command window results :
f =
60
R =
[ 60, 7008228810380513/17592186044416, (20700*557^(1/2))/7 - 476100/7, (7*n^3)/3888000000]

回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 6 月 5 日

1 投票

Here is the corrected part of your code:
...
n= double(S(double(S)>0));
P_out=subs(Po/1000, n);
R=double([f VLL n P_out])

2 件のコメント

Abdullah Ismail
Abdullah Ismail 2021 年 6 月 5 日
thank you it worked but the results comes multipled by 1e+03 why ? and how to solve this
command window results :
f = 60
R =
1.0e+03 *
0.060000000000000 0.398371685740842 1.776791722560884 0.010099069262302
>>
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 6 月 5 日
This is correct. This is how matlab displays floating point data by your matlab format display settings. You can change data display format settings using format eng or format short eng or format rat or ....

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

質問済み:

2021 年 6 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by