필터 지우기
필터 지우기

Plotting all the columns of a matrix

조회 수: 19 (최근 30일)
Vinay Killamsetty
Vinay Killamsetty 2019년 8월 29일
댓글: KALYAN ACHARJYA 2019년 8월 29일
Hi,
I want to plot columns of two matrices Z_imag and Z_real in two separate graphs.
I tried to do this code but I wasnt able to:
Z_imag=randi(10,10,3);
Z_real=randi(10,10,3);
width_mil=1:10
for i=1:1:3
figure(1)
Z_im = axes;
plot( Z_im,width_mil,Z_imag(:,i),'-o');
title('Imaginary part of the impedance');
xlabel('W [mil]');
ylabel('Im{Z}');
figure(2)
Z_re = axes;
plot(Z_re,width_mil,Z_real(:,i),'-o');
title('Real part of the impedance');
xlabel('W [mil]');
ylabel('re{Z}');
end
  댓글 수: 2
the cyclist
the cyclist 2019년 8월 29일
Can you upload your data in a MAT file, so that we can execute your code?
Vinay Killamsetty
Vinay Killamsetty 2019년 8월 29일
편집: Vinay Killamsetty 2019년 8월 29일
Thank you, I have added more information to the code
Z_imag=randi(10,10,3);
Z_real=randi(10,10,3);
width_mil=1:10
for i=1:1:3
figure(1)
Z_im = axes;
plot( Z_im,width_mil,Z_imag(:,i),'-o');
title('Imaginary part of the impedance');
xlabel('W [mil]');
ylabel('Im{Z}');
figure(2)
Z_re = axes;
plot(Z_re,width_mil,Z_real(:,i),'-o');
title('Real part of the impedance');
xlabel('W [mil]');
ylabel('re{Z}');
end
Could you help with this edited code

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

채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 8월 29일
I want to plot columns of two matricesZ_imag and Z_real in two separate graphs.
I assumed, stack bar plot of individual column elements:
matricesZ_imag=rand(4,5);
Z_real=randi(10,4,5)
figure,bar(matricesZ_imag','stacked');
figure,bar(Z_real','stacked');
  댓글 수: 10
Vinay Killamsetty
Vinay Killamsetty 2019년 8월 29일
Thank you ver much for your solution. It works
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 8월 29일
Its my pleasure, Vinay!

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

추가 답변 (1개)

madhan ravi
madhan ravi 2019년 8월 29일
편집: madhan ravi 2019년 8월 29일
No loops needed:
plot(mat)
axis([0,5,0,5])
  댓글 수: 1
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 8월 29일
편집: KALYAN ACHARJYA 2019년 8월 29일
Yes @Madhan +1 Thanks

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

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by