Creating a 2D-array with radial and angular components
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.










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!
Antworten (1)
darova
am 21 Mai 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 Kommentare
Siehe auch
Kategorien
Mehr zu Interpolation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!