Symbolic Solver Question
2 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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
更多回答(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!