Using solve and saving answers to use again

2 views (last 30 days)
Joshua
Joshua on 3 Mar 2014
Edited: Star Strider on 3 Mar 2014
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

Answers (1)

Star Strider
Star Strider on 3 Mar 2014
Edited: Star Strider on 3 Mar 2014
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))

Categories

Find more on Mathematics in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!