Plot symbolic polynomial

1 visualización (últimos 30 días)
Sukhmeet
Sukhmeet el 11 de Mayo de 2011
How to plot a symbolic expression that contains a symbol and i(imaginary).
Eg. Plot y=x^2+i+2

Respuesta aceptada

Andrew Newell
Andrew Newell el 11 de Mayo de 2011
This plots the real part of y against x:
syms x y
ezplot(y-x^2-1i-2)
Of course, it looks just the same as
syms x y
ezplot(y-x^2-2)
EDIT: For a 3D plot, you could do this:
syms x
ezplot3(x,x^2+2,1)
xlabel('x')
ylabel('Real(y)')
zlabel('Imag(y)')
  1 comentario
Sukhmeet
Sukhmeet el 11 de Mayo de 2011
Yes, I do need to plot the imaginary component, if possible. Please help.

Iniciar sesión para comentar.

Más respuestas (2)

Sean de Wolski
Sean de Wolski el 11 de Mayo de 2011
doc ezplot
  1 comentario
Sukhmeet
Sukhmeet el 11 de Mayo de 2011
Not correct I guess...
I did
syms x y
y=x^2+i+2
ezplot(y)
Not coming dude.....
error--one or more output arguments not assigned during call to C:\Matlab7\toolbox\matlab\specgraph\ezplot.m(ezplot1)

Iniciar sesión para comentar.


Susan
Susan el 25 de Mayo de 2011
I got an error with ezplot, so did this instead:
syms x y
y=x^(2+i)+2;
xx=linspace(-6,6,100);
yy=subs(y,x,xx);
plot3(xx,real(yy),imag(yy));grid
xlabel('x');ylabel('y');zlabel('z');
  1 comentario
Andrew Newell
Andrew Newell el 26 de Mayo de 2011
That should be
y=x^2+i+2;
Even better is
y=x^2+1i+2;
because then you don't have to worry about i being used as a variable.
What error did you get?

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