Symbolic Solver Question
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
bym
le 16 Nov 2011
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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Special Values dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!