use pol2cart with not equal arguments
1 view (last 30 days)
Show older comments
Hello all
Is it possible to use the pol2cart(THETA,RHO,Z) command if the vectors THETA and RHO are not equally sized and, as a result, matrix Z is not square? In my calculations, the THETA vector has 100 elements and the RHO vector has 1024 elements (so Z is 1024x100). If I increase the elements of THETA, then my program will take too long to finish (almost 8 days!).
Any help would be appreciated! Thank you all!
Antigoni
0 Comments
Accepted Answer
Sean de Wolski
on 9 Sep 2014
tic
[rr, thth] = meshgrid(1:100,1:1024);
[x,y] = pol2cart(rr,thth);
toc
Taking a few thousanths of a second on my laptop.
0 Comments
More Answers (2)
the cyclist
on 9 Sep 2014
theta = rand(1024,100);
rho = rand(1024,100);
z = rand(1024,100);
tic; [X,Y,Z] = pol2cart(theta,rho,z); toc
Elapsed time is 0.005789 seconds.
I guess I'm confused on what you are trying to do that takes so long.
Also, I am guessing that the meshgrid() function might be handy for you to convert theta and rho vectors into what you need for this.
0 Comments
See Also
Categories
Find more on Trigonometry in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!