plotting lines
이전 댓글 표시
i have a simple ques that if i have z-plane having x and y axes,and i express z=x+i*y,and x if fixed let say 5 any y=0:10 then how can i plot this thing,please guide me,i m waiting for reply
답변 (3개)
bym
2011년 12월 11일
y = 1:10;
x=5*ones(size(y));
z=x+i*y;
plot(real(z),imag(z))
댓글 수: 1
Walter Roberson
2011년 12월 11일
That will not be able to show the values of x and y on the axes.
Mohsen Davarynejad
2011년 12월 11일
y = [0:.1:10]
plot(5,y)
xlabel('Re')
ylabel('Im')
댓글 수: 3
Walter Roberson
2011년 12월 11일
What about z? y is not the imaginary quantity.
My recollection is that if you plot a scalar x against a row vector y, that you end up with a single (probably invisible) point, but that if you plot a scalar x against a column vector y, you will get a line. It is, my memory says, an exception to the "row vector is automatically converted to column vector" rule, and happens because the size of x (i.e., one) happens to match the first dimension of y (i.e., one for a row vector)
Mohsen Davarynejad
2011년 12월 11일
If z = x + yi, then x is the "real part" and y is the "imaginary part". When x is a constant and y is vector, then you will have line in the complex plane. No?
http://en.wikipedia.org/wiki/Imaginary_number
Walter Roberson
2011년 12월 12일
z might be a line in the complex plane, but plot(5,y) does not involve z at all, and plot(5,z) would be refused because it is not allowed to plot complex data except through plot(z) which in turn is the same as plot(real(z),imag(z)) -- real vs imaginary.
Walter Roberson
2011년 12월 11일
y = 0:10;
x = 5 * ones(size(y));
z = x + i * y;
Now, if "i" were a real-valued constant, you would then use
plot3(x, y, z)
However, "i" is the complex constant, so you have a line in complex space, and there is no way to draw that in one step. Instead you would need to use something like,
plot3(x, y, real(z), 'r', x, y, imag(z), 'g', x, y, abs(z), 'b')
or perhaps plot 3 separate images using subplot()
카테고리
도움말 센터 및 File Exchange에서 Special Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!