Make a 3D plot over a circle

22 views (last 30 days)
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 Comments
Rik
Rik on 26 Jan 2022
So you want to plot something similar to surf?
Bob Schreurs
Bob Schreurs on 26 Jan 2022
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).

Sign in to comment.

Accepted Answer

Benjamin Kraus
Benjamin Kraus on 26 Jan 2022
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 Comments
Bob Schreurs
Bob Schreurs on 26 Jan 2022
This is exactly what I mean, thanks a lot!
Benjamin Kraus
Benjamin Kraus on 26 Jan 2022
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)

Sign in to comment.

More Answers (1)

Torsten
Torsten on 26 Jan 2022
Edited: Torsten on 26 Jan 2022
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.
  1 Comment
Bob Schreurs
Bob Schreurs on 26 Jan 2022
Thank you for your reaction, I managed to do it.

Sign in to comment.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!