MATLAB Answers

transform a matrix with polar coordinates into a matrix with cartesian coordinates

20 views (last 30 days)
Max M
Max M on 7 Jul 2020
Commented: Max M on 7 Jul 2020
hi, I have two sets of data, each of which I need to process. After the transformation a matrix must come out at the end of each.
i found two approaches. once you can plot them and put a meshgrid on them, and then convert the newly found points. Or you can somehow use pol2cart.
This is recorded data in a helix structure. Always the angle and the radius.
the original matrix data looks like this with imagesc https://imgur.com/a/YT7wuec
and I know something like that is supposed to come out: https://imgur.com/a/toYaqDC
My dataset looks like this: DataSet (512x1000)
in the lines is the radius, and in the columns the angle.
now I want to convert my single elements in the matrix PolMat into cartesian coordinates. And save this matrix as CartMat.
thanks for the help
MATLAB Version: 9.8.0.1380330 (R2020a) Update 2

  0 Comments

Sign in to comment.

Answers (1)

KSSV
KSSV on 7 Jul 2020
Edited: KSSV on 7 Jul 2020

  9 Comments

Show 6 older comments
Max M
Max M on 7 Jul 2020
Now when I run imagesc(z) I get back my original polar matrix image. https://imgur.com/a/YT7wuec
but I would like to have one that looks like my surf(x,y,z) https://imgur.com/a/toYaqDC
  • EDIT:
  • I think i can get the image also with
contour(Xc,Yc,Zc,[1:512 1:512],'-')
  • but my computer can't make with amount of calculation
the records look exactly the same. So PolMat=z only with double instead of uint16
is it not possible to convert the polar matrix polmat into a cartesian matrix and then use imagesc(cartmat) to get the image like in surf? https://imgur.com/a/toYaqDC
KSSV
KSSV on 7 Jul 2020
When you try
surf(z)
pcolor(z)
also you will get back your original value. By specifying x,y, you can plot it as a circle or as what you wanted.
Max M
Max M on 7 Jul 2020
yes, but surf(z) is again there picture of my polar data :)
I want the polar data from (z) ((in z the polar data are stored as a matrix))transforming into Cartesian data. And then store this data in a new matrix.
The only thing I'm trying to do is store another matrix that doesn't contain polar data but Cartesian data.

Sign in to comment.