Plotting a 2-d matrix v/s a vector
조회 수: 3 (최근 30일)
이전 댓글 표시
I want a 3-d plot such that the rows and columns of the matrix are depicted on two separate axes and the third axis shows values of the vector. How can this be done?
plot(Y,sigmab);
Currently I am using this command, in which sigmab is a matrix and Y is a vector. It plots every row with Y and thus gives me multiple graphs equal to the no. of columns on the same plot. But if I want to know that a particular graph belongs to which column no., I cannot find out.(I don't even know if it is plotting eevry row or column with Y, its just a guess.)
I thought of creating a 3-d matrix, and combining Y and sigmab together in it, but I'm not sure which command would exactly give what I want, as I want the axes to be numbered according to the range of values of the matrix, also, it would take up a lot of space, so I'm kind of avoiding it unless absolutely necessary.
댓글 수: 0
답변 (1개)
Walter Roberson
2012년 6월 27일
col_labels = cellstr( num2str((1:size(sigmab,2)).', 'Column %d') );
legend( col_labels{:} );
댓글 수: 3
Walter Roberson
2012년 6월 28일
You want, "the third axis shows values of the vector". Which vector is that? Do you have a vector of values for each (row,column) position? If you do then that requires either a 4D plot or else a volume plot. 4D plots are difficult to create on what is really a 2D coordinate system. Volume plots are difficult to see "into".
If you have one value for each (row,column) position, then perhaps surf() is appropriate, perhaps in conjunction with turning a data cursor on so that you can determine the coordinates and value of a location by pointing to it.
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!