Using solve and saving answers to use again

4 次查看(过去 30 天)
Hi again, Im trying to solve a quartic equation, and save the answers in a way that i can use the variables again. So far ive got :
clear
g=9.81;
h=10;
u=1.5;
syms a b c d
a=u./sqrt(g.*h)
h=10;
d=0.5;
c=0.5;
b=solve(((a^(2)*b^4)/2)+2*c*a^(2)*b^(3)-(2-2*d+a^(2))*b^(2)-(4*c+2*c*a^(2)-4)*b+((a^(2)/2)+4*c-2*c^(2)*d-2),b,'MaxDegree',3)
Which yeilds me the response:
a =
0.1514
b =
7.1555540396380393239417370831804
1.993753283660616260599428304438
0.12926899451597696747749296398951
-11.278576317814632552018658351608
Great - however i want to save these answers as something i can use after for more calculations, im only interested in answers where b>1. This is the equation i want to use these variables in next:
e=(2(b+c)-((b-1)^3/(d*b(b-c))))/(4+(b^2-1)/(c*b))
Thanks

回答(1 个)

Star Strider
Star Strider 2014-3-3
编辑:Star Strider 2014-3-3
The save function might be what you want.
I also suggest you vectorise your equation to:
e=(2*(b+c)-((b-1).^3./(d.*b.*(b-c))))./(4+(b.^2-1)./(c.*b))

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by