How to from my vector coordinate to fit my meshgrid matrix?

36 ビュー (過去 30 日間)
Lizan
Lizan 2013 年 10 月 17 日
回答済み: Simon 2013 年 10 月 17 日
Hi,
I created a meshgrid x, y, which is an matrix of (25, 5) in sixe. Then I rearranged this to
r = [ x(:) y (:) ]
with size (125, 1).
For each 125 rows I calculated an intensity.
Now I am trying to plot the intensity as a 2D image, but since the intensity vector is in size (125,1) I am not sure how to do this so the int vector corresponds to my grid x and y.
'surf' and 'image' seems to need a grid.
is there a way to quickly reform my int vector back to fit my matrix version of the grid?
I should probably mention I have cylindrical coordinates.
[r1, phi1] = meshgrid(1:1:5, 0:((2*pi)/48):(2*pi));
gX1 = r1.*cos(phi1);
gY1 = r1.*sin(phi1);
r = [gX1(:) gY1(:)];

採用された回答

Simon
Simon 2013 年 10 月 17 日
Hi!
Your looking for the "reshape" function to reshape your intensity "I":
Imatrix = reshape(I, 25, 5)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by