Surface between plot3 plots at different points along an axis

조회 수: 20 (최근 30일)
Samuel Thompson
Samuel Thompson 2017년 3월 2일
댓글: Star Strider 2017년 3월 7일
Hi all,
I have created a script that allows me to import and plot coordinates of 2D sections along the length of a blade. I would like to be able to plot a surface between them to 'wrap' the part to appear in 3D.
A 'surf' style plot is the kind of surface I would like to achieve, however I think that this function is incorrect. I am fairly new to MATLAB and any help would be very much appreciated.
Sam
Note: Xu = x coordinate vector; Zu = Vector of upper coordinates of airfoil sections (0>); Zl = Vector of lower section coordinates (0>) sec = number of airfoil sections, in this case 6.
for i = 1:sec
plot3(Xu(:,i), repmat(spacing(:,i), size(Zu(:,i))),Zu(:,i),'--k')
hold on
plot3(Xu(:,i), repmat(spacing(:,i), size(Zl(:,i))),Zl(:,i),'--k')
end
title('Airfoil cross sections','fontweight','bold','fontsize',15)
xlabel('Normalised width of airfoil','fontsize',12)
ylabel('Normalised length along turbine blade','fontsize',12)
zlabel('Normalised thickness of airfoil','fontsize',12)
set(gca,'ydir','reverse')

채택된 답변

Star Strider
Star Strider 2017년 3월 2일
This is possible. I did it a while back with this code:
c=1; %chord length
s=num2str(2412);
NACA=s; %4 digits
d1=str2double(s(1)); % pulls the first digit out of the scalar
d2=str2double(s(2));% pulls the second digit out of the scalar
d34=str2double(s(3:4)); % pulls the third and fourth digit out of the scalar
m=d1/100;
p=d2/10;
t=d34/100;
x=linspace(0, c, 250);
yt =5*t*c*(.2969*(sqrt(x/c))+-.1260*(x/c)+-.3516*(x/c).^2+.2843*(x/c).^3+-.1015*(x/c).^4);
for k = 1:length(x)
if x(k) <= p*c
yc(k)=m*(x(k)/p^2)*(2*p-(x(k)/c));
dx(k)=(2*m)/p^2*(p-(x(k)/c));
elseif x(k) > p*c
yc(k)=m*((c-x(k))/(1-p)^2)*(1+(x(k)/c)-(2*p));
dx(k)=((2*m)/(1-p)^2)*(p-(x(k)/c));
end
%upper and lower limits of the airfoil (xu,yu) ; (xl,yl)
theta=atan(dx(k));
xu(k)=x(k)-yt(k)*sin(theta);
yu(k)=yc(k)+yt(k)*cos(theta);
xl(k)=x(k)+yt(k)*sin(theta);
yl(k)=yc(k)-yt(k)*cos(theta);
end
%plot of airfoil
plot(xu,yu)
hold on
plot(xl,yl,'r')
plot(x,yc,'g')
axis equal
grid
figure(2)
hu = mesh([xu; xu], [yu; yu], [zeros(size(xu)); ones(size(xu))]); % Upper Half Of 3-D Wing Section
hold on
hl = mesh([xl; xl], [yl; yl], [zeros(size(xl)); ones(size(xl))]); % Lower Half Of 3-D Wing Section
hold off
grid on
axis([0 1 -0.4 0.4 0 1])
rotate(hu,[1 0 0], 90)
rotate(hl,[1 0 0], 90)
title('NACA 2412 Airfoil')
The code takes the idea for the cylinder function (not the cylinder function itself) and simply uses a different contour. I used a constant contour here since that was the request. It first plots the airfoil as vertical, then rotates the axes to present it horizontally. It should not be difficult to change the cross section of the airfoil with increasing height. For hints on how to do it, experiment with the cylinder function with a varying radius to see how that works. That’s what I did to arrive at this code. Then plot it with the surf function. You will have to experiment with it to get the result you want.
  댓글 수: 2
Samuel Thompson
Samuel Thompson 2017년 3월 7일
Thank you so much for your help, this is exactly what I was looking for!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Airfoil tools에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by