Plotting Wing Surface Through a Grid Point
12 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
I have a Matlab issue that is blowing my mind..
I have a lsit of 3D grid point that represents some locations on an aircraft wing.
I would like to join this grid point with the airfoil of the wing at each z lcoation (so for each row of the grid) and then plot the surface in between (like with the mesh function).
This is how it looks like right now. All the grid coordiantes are inside a 1x3 cell called Coordinates, with 14x8 double respresenting all the x,y and z coordinates. Where 14 are the number of rows and 8 are the grid markers for each row (4 on one side and for on the other side).
To plot it I used the scatter3 function
scatter3(Coordinates{1,1} Coordinates{1,2}, Coordinates{1,3}, 25, 'k', 'filled')
While this code defined the airfoil that I want to plot at each grid rows
R = 100;
xNACA = (0:(1/R):1)';
xNACA = [xNACA(end:-1:1); xNACA]';
yNACA = (5*0.18*(0.2969*sqrt(xNACA(1:end/2))-0.126*xNACA(1:end/2)-0.3516*xNACA(1:end/2).^2+0.2843*xNACA(1:end/2).^3-0.1036*xNACA(1:end/2).^4));
xNACA = xNACA';
yNACA = [yNACA -yNACA(end:-1:1)]';
Basically I would like to do somethig like this but with the correct airfoil plotted at each row of grids.
mesh(Coordinates{1,1}, Coordinates{1,2}, Coordinates{1,3});
Thanks a lot in advance
0 个评论
回答(2 个)
William Rose
2022-8-7
I do not understand what is wrong with the final image generated by your code. It looks good to me.
The only problem I see is that the grid does not come around the leading edge of the airfoil. (I assume the wing is vertical in the plot, and that the leading edge is at approximately x/c=0, and the trailing edge is at approximately x/c=+1.25.) You can fix this by duplicating the first set of 14 points, so that is also the final set of points. Then you will have a 14x9 array of points. This should cause the mesh to wrap completely around the leading edge.
Is there something else about the image which is unsatisfactory?
2 个评论
William Rose
2022-8-7
@Fabio Taccaliti, perhaps what is undsatisfactory is that the mesh() command creates a surface that you cannot see through. If that is the prooblem, then don;t use mesh. Make the array have 14x9 points instead of 14x8, for the reason explained above.
I must admit that I do not understand the structure of Coordinates{}. Therefore I will pretend that Coordinates is a 14x9x3 array, where the final dimension of the array corresponds to the x,y,z coordinates. Then use a loop:
hold on; %to preserve points plotted with scatter3
for i=1:14
plot3(Coordinates(i,:,1),Coordinates(i,:,2),Coordinates(i,:,3),'-k')
end
This should plot a black line through 9 points (where points 1 and 9 are the same point), at each of the 14 levels.
Try it.
William Rose
2022-8-7
%% Create the array of coordinates
R = 100;
xNACA = (0:(1/R):1)';
xNACA = [xNACA(end:-1:1); xNACA]';
yNACA = (5*0.18*(0.2969*sqrt(xNACA(1:end/2))-0.126*xNACA(1:end/2)-0.3516*xNACA(1:end/2).^2+0.2843*xNACA(1:end/2).^3-0.1036*xNACA(1:end/2).^4));
xNACA = xNACA';
yNACA = [yNACA -yNACA(end:-1:1)]';
N=length(xNACA);
dZ=0.1; %spacing along z axis
Nz=14; %number of levels aong z axis
Coord=zeros(N,Nz,3); %allocate array
for k=1:Nz
Coord(:,k,1)=xNACA; %x values
Coord(:,k,2)=yNACA; %y values
Coord(:,k,3)=k*dZ; %z values
end
%% Plot the profile at each z-level
figure;
for k=1:Nz
plot3(Coord(:,k,1),Coord(:,k,2),Coord(:,k,3),'-b')
hold on
end
grid on; axis equal;
xlim([-.5 1.5]); ylim([-1 1]);
xlabel('X'); ylabel('Y'); zlabel('Z');
The code above demonstrates how to plot a set of profiles.
William Rose
2022-8-7
编辑:William Rose
2022-8-7
[edit - fix typo in comment - misspelled Joukowsky]
Here is a simple and elegant way to generate a wing profile with the same thickness-to-chord ratio as your wing. The wing coordinates are computed using a conformal map (specifically, the Joukowsky transform) of a circle in the complex plane.
a=.15; r=1+a; %r=radius of circle
z=r*(cos(0:pi/10:2*pi)+1i*sin(0:pi/10:2*pi)); %circle in the complex plane, centered at the origin
z1=z-a; %move the circle to the right
zw1=z1+1./z1; %conformal map: Joukowsky transformation
%% plot the wing profile
plot(real(zw1),imag(zw1),'-r')
This wing is about 4 times larger than yours and has approximately the same thickness to chord ratio.
If you translate the circle upward, as well as sideways, it transforms into an asymmetric wing.
b=.10; %upward displacement of circle
z2=z-a+1i*b; %move the circle to the right and up
zw2=z2+1./z2; %conformal map: Joukowsky transformation
%% plot the wing profile
hold on;
plot(real(zw2),imag(zw2),'-b')
legend('a=.15,b=0','a=.15,b=.10'); grid on; axis equal
Try it.
0 个评论
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!