フィルターのクリア

draw 4d vision graph for this matrix

6 ビュー (過去 30 日間)
mirewuti muhetaer
mirewuti muhetaer 2020 年 2 月 9 日
コメント済み: mirewuti muhetaer 2020 年 2 月 21 日
Hi,
I have a matrix in this form:
%%%%%%%%%%%%%%%%%%%%%
a b c
x1 a11 a12 a13
x1 a21 a22 a23
x1 a31 a32 a33
%%%%%%%%%%%%%%%%%%%%%
In the above, x1 is a 20 by 1 row. I wanted to draw the 4d graph to make more visilized the result. But when i was following the first example in https://www.mathworks.com/help/matlab/visualize/visualizing-four-dimensional-data.html, it always fails to generate whole plot ( just producing the last one or say the size is out of bound). Can someone help me for this.?
Thanks
  2 件のコメント
Githin John
Githin John 2020 年 2 月 11 日
There are several ways to visualize the 4D data depending on the kind of values that the 4th dimension takes (as seen in the link). Can you provide a file that contains the data you are trying to visualize and also describe it?
mirewuti muhetaer
mirewuti muhetaer 2020 年 2 月 12 日
Dear John:
Thanks so much for your response. And sorry for late reply.
I attached the xlsx file in below. The fist row(from 2d to 5th column) is a variable called A. The frist column(except first input) is the three(corresponding to some variable called C) time repeation of the inflation index, And the second row to last raw, second column to last column is the corresponding values called B.
So, i want a 4d vision such that A, B and inflation index as the x, y, and z axis. Then draw the graph for three different values for C.
I would really appreciate if you could help.
Thanks in advance.

サインインしてコメントする。

採用された回答

Githin John
Githin John 2020 年 2 月 21 日
Looking at the data you shared, the different columns of B have very different ranges. For example, column 3 of B has data in the 1e-4 range while the 4th column has data in the -16 range. So plotting all this data in a single plot (something similar to what is done in the link you shared) may not be the best approach. Also the difference in values between each time iteration is very small. So if you plot it all in the same graph, you may not be able to notice the variations. You may try using the subplot to get a plot like below. Each plot is for one value of A.
subplot(4,1,1);
scatter(C,B(:,1),'r')
subplot(4,1,2);
scatter(C,B(:,2),'b')
subplot(4,1,3);
scatter(C,B(:,4),'g')
subplot(4,1,4);
scatter(C,B(:,3),'c')
However, if you wished to make a 4D plot. you could something like this
C1B1=B(1:21,1);
C1B2=B(1:21,2);
C1B3=B(1:21,3);
C1B4=B(1:21,4);
C2B1=B(22:42,1);
C2B2=B(22:42,2);
C2B3=B(22:42,3);
C2B4=B(22:42,4);
C3B1=B(43:63,1);
C3B2=B(43:63,2);
C3B3=B(43:63,3);
C3B4=B(43:63,4);
C1=C(1:21);
C2=C(22:42);
C3=C(43:63);
A1=A(1)*ones(21,1);
A2=A(2)*ones(21,1);
A3=A(3)*ones(21,1);
A4=A(4)*ones(21,1);
plot3(C(1:21),A1,C1B1,'r*')
grid on
hold on
plot3(C1,A2,C1B2,'r-')
plot3(C1,A3,C1B3,'r-.')
plot3(C1,A4,C1B4,'ro')
plot3(C2,A1,C2B1,'b*')
plot3(C2,A2,C2B2,'b-')
plot3(C2,A3,C2B3,'b-.')
plot3(C2,A4,C2B4,'bo')
plot3(C3,A1,C3B1,'g*')
plot3(C3,A2,C3B2,'g-')
plot3(C3,A3,C3B3,'g-.')
plot3(C3,A4,C3B4,'go')
xlabel('C');
ylabel('A');
zlabel('B');
Where, A are the 4 values in row 1. B is the 63x4 matrix from the excel sheet. C is the 63x1 values of repeated time iteration.
  1 件のコメント
mirewuti muhetaer
mirewuti muhetaer 2020 年 2 月 21 日
Dear John:
Thanks so much. The first graph makes more sense. Thanks for your help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by