- meshgrid - https://www.mathworks.com/help/matlab/ref/meshgrid.html
- contourf - https://www.mathworks.com/help/matlab/ref/contourf.html
Polar Label Type Contour
조회 수: 1 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
ag
2024년 10월 2일
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!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!