Plotting with a symbolic expression

3 visualizaciones (últimos 30 días)
Kivanc Bugan
Kivanc Bugan el 2 de Jul. de 2015
Comentada: Walter Roberson el 3 de Jul. de 2015
Hi,
I have a symbolic expression kappa and I am sweeping a variable omega from -4*kappa to 4*kappa. What I want to do is get a plot whose x axis corresponds to omega. In other words my x axis should go from -4 to 4 and the unit should be kappa. When I try to plot I am getting the following error:
Error using plot Conversion to double from sym is not possible.
Error in eqn_1 (line 55) plot(omega_f(:),trans(:))
Thanks in advance.
  1 comentario
Sean de Wolski
Sean de Wolski el 2 de Jul. de 2015
Please provide a full minimal working example.

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 2 de Jul. de 2015
That is not possible. The plotting functions need specific numeric data to work with. You can substitute in 1 for kappa and plot that way and then change the xticklabel . And the datacursormode callback if that's important to you.
  2 comentarios
Kivanc Bugan
Kivanc Bugan el 2 de Jul. de 2015
How about ezplot? Would it work?
Walter Roberson
Walter Roberson el 3 de Jul. de 2015
No. See http://www.mathworks.com/help/symbolic/ezplot.html and notice that if you do not specify a range then ranges will be assumed for both variables, and if you do specify a range then the range will be used for both variables. There is no provision to keep one of the variables symbolic.

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by