How can I plot a symbolic function or determine a finite and real starting guess for fzero?
Mostrar comentarios más antiguos
Hello,
I have a very long and somewhat complicated complex function that I need to find the roots of. It is a function of "s", which is imaginary, and which I had to define as a symbol in order to work through previous steps and get the function (Functionofs). For those interested in the background math, I am trying to solve the characteristic equation from a determinant of a 4x4 matrix made from a transfer function made from the equations of motion of a beam. When I try starting guesses that I think would make sense using the fzero command, I keep getting the error "Function value at starting guess must be finite and real." I have tried the following:
1) Tried substituting values using subs(Functionofs,s,1*i) to see if I could happen upon something that would work. It just finished (after several minutes) and gave me an extremely long (output truncated) expression with fractions, etc. Does not seem to be of any use. I used simplify(ans) and got it down to a manageable (sort of) size, but it is still a symbol- can I convert this back to a decimal number or expression somehow?
2) Tried to plot Functionofs, but received an error that SYM could not be converted to DOUBLE to plot.
Does anyone have any ideas on what else I could try or how to get around these errors? I have not found a way to convert a symbol to a decimal number- is there one?
Thank you! It's a pretty interesting problem! -Kaitlin
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 5 de Sept. de 2012
1 voto
Use vpa() to reduce the constant expressions.
Use matlabFunction() to convert a symbolic expression to a function handle.
1 comentario
K
el 5 de Sept. de 2012
Categorías
Más información sobre Conversion Between Symbolic and Numeric en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!