Polar Label Type Contour

2 Ansichten (letzte 30 Tage)
Alexi
Alexi am 8 Jan. 2023
Beantwortet: ag am 2 Okt. 2024
I have 3 types of data. The first data is the angle, the second data is the radial distance, the third data is the pre-calculated data as a function of the first two data.
precomputed data
angle=[a1;a2;a3...];
radial =[r1;r2;r3..];
value=[var1;var2;var3...];
I tried this but ı didnt good result i think i'm wrong: The z values ​​must be a value in the x and y coordinates, not a function of x and y.
for example
angle = [0 36 72 108 144 180 216 252 288 324 360];
radial = [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1];
value=[0.1;0.2;...........];
[a,r] = meshgrid(angle,radial);
[x,y] = pol2cart(a,r);
value = [var1;var2;var3...];; %must be located in x y coordinates
contourf(X,Y,Z,'ShowText','on')
daspect([1 1 1])
How can I obtain the circular contour distribution that indicates the position of the data calculated with the angle and distance data according to the angle and radial distance and writes (for example c label type) the value as a number?
I am sharing the similar graph that I want to achieve in the attachment.

Antworten (1)

ag
ag am 2 Okt. 2024
Hi Alexi,
To create a circular contour plot using your angle, radial distance, and precomputed values, you will need to map your data onto a grid in Cartesian coordinates, then use the "contourf" function to visualize it.
The below code snippet shows how to achieve this using dummy data:
angle = [0 36 72 108 144 180 216 252 288 324 360];
radial = [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1];
value = rand(length(radial), length(angle));
% Create a meshgrid
[a, r] = meshgrid(deg2rad(angle), radial);
% Convert polar coordinates to Cartesian coordinates
[x, y] = pol2cart(a, r);
% Plot using contourf
figure;
contourf(x, y, value, 'ShowText', 'on');
colorbar;
title('Circular Contour Plot');
xlabel('X');
ylabel('Y');
For more details, please refer to the following MathWorks documentations:
Hope this helps!

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by