Creating a 2D-array with radial and angular components
5 views (last 30 days)
Show older comments
I have a function which contains a radial and an angular part, which I need to enter into a matrix (for evaluating measured data).
My first approach was to create a matrix with the appropriate cartesian coordinates x,y and a second matrix () with the corresponding angle with respect to a certain point which defines the centre. From this, I calculated for every point in the matrix the radial function and then multiplied it with the angular part. Computationally, this is quite a brutal way, but it works.
: The radial function contains binomial coefficients which blow up the computational time.
: I want to calculate the radial function once (say, for the angle ) and then "project" it onto the whole circle depending on the angle α, as in complex multiplication: , where .
: The accuracy of the radial plot is lower.
I attached an examplary calculation with a linear radial function, including the code.
Is there a more elegant way for this kind of problem? For instance, a function designed for projection onto a unit circle? Unfortunately, my research did not yield anything suitable :(
Thank you for your answers in advance!
Answers (1)
darova
on 21 May 2020
Create polar coordinates (radius and angle) using meshgrid. Convert data into cartesian system and calculate
[R,T] = meshgrid(0:5,0:20:360); % radius and angle
[X1,Y1] = pol2cart(T*pi/180,R); % X and Y
[X2,Y2] = meshgrid(-5:5); % cartesian X Y
Z1 = X1+Y1.^2;
Z2 = X2+Y2.^2;
surf(X1,Y1,Z1)
surface(X2,Y2,Z2,'facecolor','none')
axis vis3d
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!