我有一个Matlab文件,它读取的文本文件包含r
,c
和Beta
的值。使用这3列我想将它与Matlab中的文件结合使用翼型坐标,我最终将它分成切片(我想要大约30个)的X和Y坐标。
我面临的问题是dlmwrite
没有提供任何输出文件。该文件之前工作,但现在我没有看到任何xls文件出现。我特意看了一下dlmwrite,但我找不到我的错误。
n
是我想要创建的切片数,它等于文本文件中包含r
,c
和Beta
的行数。 Z = ones(81,1)
是翼型坐标的数量(X
和Y
一起计为1)
clear all
close all
clc
%Create and output propeller geometry text files for solidworks
Propeller_Geometry = 'lllllaatsten.txt';
Airfoil_Geometry = 'as5048.txt'; %airfoil x_c, z_c
[r, c, beta] = textread(Propeller_Geometry) % (m, m, deg)
[x_c, z_c] = textread(Airfoil_Geometry); %(-, -)
c = c * 1000; % Chord Length (mm)
r = r * 1000; % Radius Length (mm)
beta = beta * pi / 180; % Angle from rotational velocity vector to lower blade edge (rad)
n = 50; % Number of slices
hold on
plot(x_c, z_c, '-b')
axis([0 1 -0.5 0.5])
xlabel('Unit Chord ( x/c)', 'fontsize', 14)
ylabel('Unit Height (z/c)', 'fontsize', 14)
title('TA22 Airfoil Geometry', 'fontsize', 14)
%Create dimensional slices
for i=1:n+1
x = x_c * c(i); % Dimensional Chord (mm)
y = z_c * c(i); % Dimensional Height (mm)
X = x * cos(-beta(i)) - y * sin(-beta(i)); % Rotated x-coordinate
Y = y * cos(-beta(i)) + x * sin(-beta(i)); % Rotated y-coordinate
Z = ones(81,1) * r(i);
P = horzcat(-X, Y, Z);
%dlmwrite(['Slice_' int2str(i)'.xls'], P, 'delimiter', '\t', 'precision', 8)
%dlmwrite(['stuk_' int2str(i) '.txt'], P, 'delimiter', '\t', 'precision', 8)
dlmwrite (['stuk_' int2str(i) '.xls'], P, '-append', 'delimiter', '\t', 'newline', 'pc')
plot3(Z, -X, Y); %cm
axis([0 50 -30 0 -7 1])
xlabel('Radius (mm)', 'fontsize', 18)
ylabel('Chord (mm)', 'fontsize', 18)
zlabel('Height (cm)', 'fontsize', 18)
title('Propeller geometry', 'fontsize', 18)
grid
end