필터 지우기
필터 지우기

Line Plot Complex Numbers

조회 수: 4 (최근 30일)
Artificial_Spark
Artificial_Spark 2017년 2월 5일
댓글: Artificial_Spark 2017년 2월 15일
I'm having trouble producing a line plot graph using complex numbers. Currently the graph only shows the markers of the data plotted. Should l use a x-y graph and pretend the y is the imaginary axis? Or is a 3d plot a simpler way? I need to actually see the line from the origin point. Thank you for the assistance.
Here is my code:
%Variables
z1 = 0 + 2j;
z2 = -1 + 1j;
z3 = -3 - 4j;
z4 = 0 - 1j;
real_z1 = real(z1);
imag_z1 = imag(z1);
real_z2 = real(z2);
imag_z2 = imag(z2);
real_z3 = real(z3);
imag_z3 = imag(z3);
real_z4 = real(z4);
imag_z4 = imag(z4);
%Graph
plot(real_z1,imag_z1,'*',real_z2,imag_z2,'*',real_z3,imag_z3,'*',real_z4,imag_z4,'*');
grid on
axis([-5,5,-5,5])
xlabel('REAL'), ylabel('IMAG');
title('Complex Numbers');
legend('z1 = 0 + 2j','z2 = -1 + 1j','z3 = -3 - 4j','z4 = 0 - 1j');
  댓글 수: 2
Ahmad Moniri
Ahmad Moniri 2017년 2월 14일
Have you looked at the function plotv? https://uk.mathworks.com/help/nnet/ref/plotv.html
Artificial_Spark
Artificial_Spark 2017년 2월 15일
No l haven't heard of it before. I modified the code to use Quiver instead.

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

채택된 답변

KSSV
KSSV 2017년 2월 14일
편집: KSSV 2017년 2월 14일
z1 = 0 + 2j;
z2 = -1 + 1j;
z3 = -3 - 4j;
z4 = 0 - 1j;
z = [z1 ; z2; z3; z4] ;
plot(real(z),imag(z)) % line plot
hold on
plot(real(z),imag(z),'*r') % marker plot

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Particle & Nuclear Physics에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by