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 comentarios

Rik
Rik el 26 de En. de 2022
So you want to plot something similar to surf?
Bob Schreurs
Bob Schreurs el 26 de En. de 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).

Iniciar sesión para comentar.

 Respuesta aceptada

Benjamin Kraus
Benjamin Kraus el 26 de En. de 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 comentarios

Torsten
Torsten el 26 de En. de 2022
I think the OP meant to rotate the measurement values around the z axis to create a 2d surface.
Bob Schreurs
Bob Schreurs el 26 de En. de 2022
Thanks a lot Benjamin for your input!
The first picture looks like what I am trying to do, but Torsten is right. I am trying to rotate the measurement values over the whole circle as well.
I made a simple drawing in paint to make sure you understand what I mean. Instead of 4 times the measurement values (as shown in the attachment), it would be nice to have a lot more. In this way it becomes a continuous 3D plot.
Benjamin Kraus
Benjamin Kraus el 26 de En. de 2022
Editada: Benjamin Kraus el 26 de En. de 2022
That makes much more sense. How does this look?
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, 100);
z = z.*windSpeed'; % Note the use of implicit scalar expansion
surf(x,y,z,'FaceAlpha', 0.4);
You can mess with how this looks by adjusting the CData, FaceColor, EdgeColor, FaceAlpha, EdgeAlpha, and AlphaData properties on the Surface object, or changing the view angle (using the view command).
Note I used implicit scalar expansion (see my comment in the code). When you use element-wise multiplication (.*) between a matrix and a vector, the vector is automatically replicated to match the size of the matrix. See this doc page for more details.
Bob Schreurs
Bob Schreurs el 26 de En. de 2022
This is exactly what I mean, thanks a lot!
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)

Iniciar sesión para comentar.

Más respuestas (1)

Torsten
Torsten el 26 de En. de 2022
Editada: Torsten el 26 de En. de 2022

1 voto

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 comentario

Bob Schreurs
Bob Schreurs el 26 de En. de 2022
Thank you for your reaction, I managed to do it.

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Productos

Versión

R2020b

Etiquetas

Preguntada:

el 26 de En. de 2022

Comentada:

el 26 de En. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by