필터 지우기
필터 지우기

Best way to convert from a 1D matrix to a 3D matrix with isotropic distribution

조회 수: 2 (최근 30일)
I have 1D data which has values at equally spaced intervals from r=0 to r=r, where r is a distance i.e.
r x
0.0 1.16000
0.2 1.21000
0.5 1.24000
0.7 1.25000
0.9 1.24000
1.2 1.22000
1.4 1.21000
1.6 1.18000
etc
This data is isotropic (from r=0) in three dimensions, so I want to go from a 1D dataset to 3D. I thought that the best option may be to convert to spherical polar coordinates using the function cart2pol and writing a For loop to loop around all values of theta and phi, filling in the values, then convert back to cartesian coodinates. However, I know that for loops can be time consuming computationally in Matlab and wondered if there was a better way of doing it? I am using Matlab version R2011B with the image processing toolbox. Thanks!
  댓글 수: 2
Azzi Abdelmalek
Azzi Abdelmalek 2014년 2월 4일
The conversion is based on what? How can use cart2pol with one 1-D array?
Catherine Scott
Catherine Scott 2014년 2월 4일
A good point, I don't actually need to convert to spherical polar coordinates because I already have r (which is rho in the Matlab documentation) and I can assume that the data I have is at theta=phi=0 (where theta= azimuth and phi=elevation). The next bit still stands I believe, so I would then loop over all possible values of theta and phi, then convert to cartesian (using sph2cart). So is there a more efficient method for this part? Apologies for the mix up and thanks for the comment.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Trigonometry에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by