필터 지우기
필터 지우기

Question about plotting matrix

조회 수: 2 (최근 30일)
Ameer Hamza
Ameer Hamza 2018년 5월 16일
댓글: Dennis 2018년 5월 17일
Hello I have problem in plotting (2*2) loop matrix. My matrice code is as follow :
theta=0:pi/6:2*pi;
A=[cos(theta), 0 ; 0,sin(theta)];
I need to plot the matrix for each theta value, in my case there is 7 iterations (theta=0:pi/6:2*pi), it means 7 values of theta and 7 resulting matrices for each value of theta. For theta=0; A=[1, 0 ; 0, 0]; .... For theta=2*pi; A=[1, 0 ; 0, -2.4493e-16];
plot(A)
plot(A,'o')
I need to plot all the values of A, but ploting dont give inside values.
  댓글 수: 3
Rik
Rik 2018년 5월 16일
What do you mean with plotting this matrix? Should one row be considered x-coordinate and the other y-coordinate? Should all values be plotted against their column position (which would result in two lines if you had chosen a line format)?
Aakash Deep
Aakash Deep 2018년 5월 16일
You can not directly plot a matrix but if your data is stored in a matrix you have to plot row/column vectors individually. The variable theta don't store 7 values, there are 13 values in 0:pi/6:2*pi, if you want 7 values in this range use linspace instead.

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

답변 (1개)

Ameer Hamza
Ameer Hamza 2018년 5월 17일
We need to get all the values of matrix A in every iteration and plot them not the final values.
close all
clear all
clc
for a = 0:pi/6:2*pi;
r = 2;
x = sin (a);
y = cos(a);
z = r*(x+y);
A = [z 0 0;0 z 0;0 0 z];
disp (A)
plot (A, 'o')
end
  댓글 수: 1
Dennis
Dennis 2018년 5월 17일
So you want 13 plots? How do you want to plot A? How does a [2 0 0; 0 2 0; 0 0 2] plot look like? You want to have a 3D plot?

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

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by