Plot symbolic polynomial

조회 수: 1 (최근 30일)
Sukhmeet
Sukhmeet 2011년 5월 11일
How to plot a symbolic expression that contains a symbol and i(imaginary).
Eg. Plot y=x^2+i+2

채택된 답변

Andrew Newell
Andrew Newell 2011년 5월 11일
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
Sukhmeet
Sukhmeet 2011년 5월 11일
Yes, I do need to plot the imaginary component, if possible. Please help.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Sean de Wolski
Sean de Wolski 2011년 5월 11일
doc ezplot
  댓글 수: 1
Sukhmeet
Sukhmeet 2011년 5월 11일
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)

댓글을 달려면 로그인하십시오.


Susan
Susan 2011년 5월 25일
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
Andrew Newell
Andrew Newell 2011년 5월 26일
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?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by