Using solve and saving answers to use again

조회 수: 4 (최근 30일)
Joshua
Joshua 2014년 3월 3일
편집: Star Strider 2014년 3월 3일
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