3D polar plot with elevation data
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have 3 column vectors in which the first one (v1) is wind direction in degrees, the second one (v2) is wind speed, and the third one (v3) is elevation data. All three vectors have the same length, and I want to plot these data as follow:
At the horizontal plane, I want to have a polar plot of the wind direction vector (v1). I want v2 as arrows (or stem-like features) pointing out from the vertical v3 axis at its corresponding wind direction (v2 = f(v1,v3)), please see the attached hand drawing figure as an example.

0 comentarios
Respuestas (1)
Harshavardhan
el 20 de Feb. de 2025
As of now MATLAB does not have a default function for a vector plot with cylindrical axis.
However, we can plot by converting from polar to cartesian and then use the “quiver3” function to plot. You can use the code given below for reference.
% Sample data
v1 = [0, 45, 90, 135, 180, 225, 270, 315]; % Wind direction in degrees
v2 = [10, 15, 20, 25, 30, 35, 40, 45]; % Wind speed
v3 = [100, 150, 200, 250, 300, 350, 400, 450]; % Elevation
% Convert wind direction from degrees to radians
theta = deg2rad(v1);
% Convert polar coordinates to Cartesian for plotting
[u, v] = pol2cart(theta, v2);
% Create a 3D plot
figure;
hold on;
% Plot the wind directions and speeds as arrows with no automatic scaling
quiver3(zeros(size(u)), zeros(size(v)), v3, u, v, zeros(size(v3)), 0, 'r', 'LineWidth', 1.5);
% Customize the plot
xlabel('X (Wind Speed Component)');
ylabel('Y (Wind Speed Component)');
zlabel('Elevation');
title('3D Polar-like Plot of Wind Data');
grid on;
view(3); % Set view to 3D
axis equal;
hold off;
For more information on “quiver3” and “pol2cart” you can run the following commands in a MATLAB command window:
doc quiver3
doc pol2cart
Hope this helps.
0 comentarios
Ver también
Categorías
Más información sobre Simscape Electrical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!