
Symbolic toolbox help using solve command
3 views (last 30 days)
Show older comments
I have the following simple code and Im not sure how else to solve it for more than one equation, the variable hl and hr can change at any time so I want matlab to automatically solve for the different equation im assuming its something simple that i have missed, thanks in advance kyle
hl = 1;
hr = 0.1;
g=9.81;
syms s
geneqn = s*((s - ((g*hr)/(4*s))*(1+(sqrt(1+((8*s^2)/(g*hr)))))) + 2*(sqrt(((g*hr)/2)*(sqrt(1+((8*s^2)/(g*hr)))-1))) - 2*sqrt(g*hl));
S = solve('geneqn=0')
s=0 << %I know that this is not correct
0 Comments
Accepted Answer
Andrei Bobrov
on 12 Mar 2012
hl = 1; hr = 0.1; g=9.81;
syms s
geneqn = s*((s - ((g*hr)/(4*s))*(1+(sqrt(1+((8*s^2)/(g*hr))))))...
+ 2*(sqrt(((g*hr)/2)*(sqrt(1+((8*s^2)/(g*hr)))-1))) - 2*sqrt(g*hl));
out = solve(geneqn,s)
on my PC:

More Answers (0)
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!