Symbolic toolbox help using solve command

3 visualizaciones (últimos 30 días)
kyle lyth
kyle lyth el 12 de Mzo. de 2012
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

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 12 de Mzo. de 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:
  1 comentario
kyle lyth
kyle lyth el 12 de Mzo. de 2012
thank you for the quick response, i didn't realise it would solve for zero automatically :) thanks again kyle

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by