フィルターのクリア

Symbolic Solver Question

1 回表示 (過去 30 日間)
Stephen
Stephen 2011 年 11 月 16 日
Hey, quite new to MATLAB so sorry if this is a very rookie issue :/ Also tried searching for it but couldn't see it, sorry if it's already been asked.
I have the below in a matlab function file...
clc;
Pr=140000;
Cdz=0.025;
Rho=1.225;
S=16.2;
W=12753;
e=0.85;
AR=7.469136;
a=(0.5*Cdz*Rho*S)
b=((2*W^2)/(pi*e*AR*Rho*S))
syms v;
solve('((a)*v^3)+(((b)/v))-Pr')
However whilst it will give me the values of a and b, it won't use those values (or Pr) in the equation it's solving. Instead it will give me an extremly complex answer. So I'm having to run it twice, once to get a value for a and b (not hard to work out but that's what matlab is there for right?! :P) and then I have to go back and insert those values into the equation (along with Pr) and run it again to get my solution.
What am I missing to get the solver to use the calculated values of a, b and Pr? Really confused what I've overlooked :s

採用された回答

bym
bym 2011 年 11 月 16 日
once you have declared syms v, do not submit the equation to solve in quotes. use double() to convert your answer to floating point
double(solve(((a)*v^3)+(((b)/v))-Pr))
ans =
80.5823
5.8721
-43.2272 +71.6421i
-43.2272 -71.6421i
  1 件のコメント
Stephen
Stephen 2011 年 11 月 16 日
Awesome, thank you very much :D

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by