Make a 3D plot over a circle

5 次查看(过去 30 天)
Hello everyone,
I am currently researching the characteristic of a fan. Therefore I am measuring the wind speed on 9 different points as can be seen in the attachment: 'Ventilator en meetpunten'.
I plotted the velocity at every point I measured it in a 2D plot as can be seen in the attachment: ''
The velocity values plotted on the y-axis are: 0, 0.854, 1.686, 6.7075, 8.52, 10.15, 10.4775, 9.825, 9.65, 0.
Is it possible to plot this 2D graph over a cirle (2*PI) in MatLab, so it becomes a 3D plot? If yes, I would like some help with it.
Thank you in advance.
With kind regards,
Bob Schreurs
  2 个评论
Rik
Rik 2022-1-26
So you want to plot something similar to surf?
Bob Schreurs
Bob Schreurs 2022-1-26
Exactly, but with the circle as base plane and the 2D plot over the circle, so it becomes 3D (if you understand what I mean).

请先登录,再进行评论。

采纳的回答

Benjamin Kraus
Benjamin Kraus 2022-1-26
There are tons of options for doing this in MATLAB. Here are a few:
% First define some constants and your input data (as I understand it from
% the picture).
centerRadius = 150/2;
outerRadius = 730/2;
windSpeed = [0, 0.854, 1.686, 6.7075, 8.52, 10.15, 10.4775, 9.825, 9.65, 0];
theta = zeros(size(windSpeed));
r = linspace(centerRadius, outerRadius, numel(windSpeed));
The first option is to use the rectangle command to draw circles and scatter3 to draw dots at each reading. These circles will be drawn at Z = 0.
figure
x = r.*cos(theta);
y = r.*sin(theta);
scatter3(x, y, windSpeed, 'filled')
rectangle('Position',outerRadius*[-1 -1 2 2], 'Curvature', [1 1])
rectangle('Position',centerRadius*[-1 -1 2 2], 'Curvature', [1 1])
If you want to draw those "rectangles" at something other than Z = 0, then you can use an hgtransform.
figure
x = r.*cos(theta);
y = r.*sin(theta);
scatter3(x, y, windSpeed, 'filled')
t = hgtransform;
rectangle('Parent',t,'Position',outerRadius*[-1 -1 2 2], 'Curvature', [1 1])
rectangle('Parent',t,'Position',centerRadius*[-1 -1 2 2], 'Curvature', [1 1])
t.Matrix = makehgtform('translate', [0 0 5]);
More likely you want to draw some kind of 3D cylinder, and you can do that using a combination of cylinder and surface.
figure
x = r.*cos(theta);
y = r.*sin(theta);
scatter3(x, y, windSpeed, 'filled')
[x, y, z] = cylinder(outerRadius, 101);
surface(x,y,z*max(windSpeed),'FaceAlpha',0.1,'EdgeColor','none');
[x, y, z] = cylinder(centerRadius, 101);
surface(x,y,z*max(windSpeed),'FaceAlpha',0.1,'EdgeColor','none');
Do any of these pictures look like what you are trying to do?
  5 个评论
Bob Schreurs
Bob Schreurs 2022-1-26
This is exactly what I mean, thanks a lot!
Benjamin Kraus
Benjamin Kraus 2022-1-26
For example, I tweaked some more settings and overlayed two surfaces to get fewer edge lines but keep the smooth curve:
centerRadius = 150/2;
outerRadius = 730/2;
windSpeed = [0, 0.854, 1.686, 6.7075, 8.52, 10.15, 10.4775, 9.825, 9.65, 0];
theta = zeros(size(windSpeed));
r = linspace(centerRadius, outerRadius, numel(windSpeed));
[x, y, z] = cylinder(r, 361);
z = z.*windSpeed'; % Note the use of implicit scalar expansion
s = surf(x,y,z,'FaceAlpha', 0.4,'MeshStyle','row');
s.FaceColor = lines(1);
[x, y, z] = cylinder(r, 8);
z = z.*windSpeed';
surface(x,y,z,'FaceColor','none','MeshStyle','column')
view(-45, 70)

请先登录,再进行评论。

更多回答(1 个)

Torsten
Torsten 2022-1-26
编辑:Torsten 2022-1-26
r=linspace(75,365,25);
phi=linspace(0,2*pi,36);
[R,PHI]=meshgrid(r,phi);
X=R.*cos(PHI);
Y=R.*sin(PHI);
Z=interp1(rm,velm,sqrt(X.^2+Y.^2));
surf(X,Y,Z)
where rm and velm are radius and velocity of your measurements.

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by