Ploting stack of matrices
이전 댓글 표시
Hi,
I have stack of 100 A= 4*4 matrices ,and a vector of B= 1*100 elements. I want to plot (B,A) . What are possible solutions for this ? Do I have to make a function that will respond to one matrix ata time for certain element ?
Also in matlab if you have 100*4*4 matrix what does it mean?
댓글 수: 4
Walter Roberson
2019년 10월 18일
How many lines are you expecting? 100? 4? 16?
A 100 x 4 x 4 matrix is a block of memory that is modelled as if it were arranged in a cuboid with 100 rows and 4 columns and 4 layers ("panes"). The block is stored with left most index varying most quickly, so A(100,4,2) is the previous item in memory from A(1,1,3)
sharay
2019년 10월 18일
Walter Roberson
2019년 10월 18일
How many lines do you expect to be drawn as a result?
sharay
2019년 10월 21일
답변 (3개)
KALYAN ACHARJYA
2019년 10월 18일
편집: KALYAN ACHARJYA
2019년 10월 18일
A=randi(100,[100 4 4]);
%........... ^[rows column number of stack planes]
B=randi(100,[100 4]);
[r c d]=size(A); % d represents here number of stacks planes
for i=1:d
plot(A(:,:,i),B);
hold on;
end
Read about multidimentinal array here
But if I have to generate 100 4*4 matrices what should be the procedure?
Are you looking for 100 stacks for 4x4 matrics, then
A=randi(100,[4 4 100]);
%.......^ represents maximum allowed values in the randomly generated matrics
Non Integer, then
A=rand(4,4,100);
Hope it helps!
댓글 수: 6
sharay
2019년 10월 18일
KALYAN ACHARJYA
2019년 10월 18일
편집: KALYAN ACHARJYA
2019년 10월 18일
If the X is 1*100 then B must be same as Y must be same size 1*100 with any number of stacks, example
X=randi(100,[1 100]);
%........... ^[rows column number]
Y=randi(100,[1 100 n]); % here n is any number of stacks
sharay
2019년 10월 18일
KALYAN ACHARJYA
2019년 10월 18일
편집: KALYAN ACHARJYA
2019년 10월 18일
Lets make it simple to undestand the issue
Say X is 1*100 (It's menas it having 100 elements) and Y is 4*4 matrices (Lets say 1 matrices first) having 16 elements, how you going to plot those numbers?
sharay
2019년 10월 18일
KALYAN ACHARJYA
2019년 10월 18일
편집: KALYAN ACHARJYA
2019년 10월 18일
You can talk with me through my number (please check profile)
Walter Roberson
2019년 10월 18일
If you have x being a 100 x 1 matrix, and y being as 100 x 4 x 4 matrix, then
plot(x, reshape(y, size(y,1), []))
This would create 16 lines, in the order y(:,1,1), y(:,2,1), y(:,3,1), y(:,4,1), y(:,1,2), y(:,2,2), y(:,3,2) and so on.
댓글 수: 2
sharay
2019년 10월 21일
Walter Roberson
2019년 10월 21일
Yp =
reshape( permute(y, [3 1 2]), [], 16);
plot(x, Yp) ;
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!