pol2cart with matrices
古いコメントを表示
i have polar coordinates in a matrix 512x500 which can be displayed as in A with imagesc.
I can now convert them into cartesian coordinates. Since it is a spiral they will actually be cylindrical coordinates.
With
angle= linspace(0, 2*pi, size(polvec,2));
rad = linspace(1, 100, size(polvec,1));
[x,y,z] = pol2cart(a,b,c);
figure
surf(x,y,z)
view(2);
I also get a 2-D plot from above (B). But how do I convert this into a real 2-D transfomation? And how do I get a matrix out of it that now stores my data in 2D coordinates?

Thanks
2 件のコメント
the cyclist
2020 年 7 月 4 日
Can you upload your data in a MAT file (using the paper clip icon in the INSERT section of the toolbar here)?
prrrrr
2020 年 7 月 5 日
回答 (1 件)
Star Strider
2020 年 7 月 4 日
You can get a 2D plot of it by using:
view(0,90)
Another (probably better) option would be to use the contour function instead of surf or mesh. The arguments are the same.
4 件のコメント
prrrrr
2020 年 7 月 4 日
Star Strider
2020 年 7 月 4 日
Using the contour function will give you the (x,y) coordinates for each contour level as the first output, if you request outputs. If you know the level you want, you can specify that, and the function will provide two (x,y) vector pairs for that level, one for the inner contour and one for the outer contour. You can then save these to plot however you wish.
Without your matrix, I can only describe the approach. I cannot write specific code for it.
Star Strider
2020 年 7 月 5 日
To display the contour at a specific height, specify the height:
contour(X,Y,Z, [150 150])
Here, it will show the contour at 150. (This is described in the documentation.)
カテゴリ
ヘルプ センター および File Exchange で Lighting, Transparency, and Shading についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!