# my matlab code to make 2601points from one airfoil

%ytsunsh [at] g m a i l[dot]com
%www.shfrp.com
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%make a new variable as “input” in matlab
%x y

%0.0000 0.00000
%0.00004 0.00203
%0.00037 0.00550
%0.0011 0.00874
%0.00234 0.01186
%0.00405 0.01499
%0.01212 0.02520
%…
%1.00000 0.00000
%…
%0.0000 0.00000

%(from 0，0 through upside to 1，0 then through downside to 0,0)

%then run this function the variable"output"gives out the result

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%[][][][][][][][][][][][][][][][][][][][][][][][]
b2=size(input)*[1;0];
for i=1:b2;
if input(i,1)==1
b1=i;
break;
end
end
for i=1:b2;
if input(i,1)>0.12
b3=i;
break;
end
end
for i=b2:-1:1;
if input(i,1)>0.12
b4=i;
break;
end
end
%[][][][][][][][][][][][][][][][][][][][][][][][]
uper(1:1:b1,1)=input(1:1:b1,1);
uper(1:1:b1,2)=input(1:1:b1,2);
down(1:b2+1-b1,1)=input(b2:-1:b1,1);
down(1:b2+1-b1,2)=input(b2:-1:b1,2);
%[][][][][][][][][][][][][][][][][][][][][][][][]
uper1(1:5,1)=0:0.000125:0.00050;
uper1(5:299,1)=0.0005:0.00025:0.074;
uper1(299:451,1)=0.074:0.0005:0.15;
uper1(451:1301,1)=0.15:0.001:1;
%[][][][][][][][][][][][][][][][][][][][][][][][]
uper1(:,2)=spline(uper(:,1),uper(:,2),uper1(:,1));%
%[][][][][][][][][][][][][][][][][][][][][][][][]
down1(:,1)=uper1(1301:-1:1,1);
down1(:,2)=spline(down(:,1),down(:,2),down1(:,1));%
%[][][][][][][][][][][][][][][][][][][][][][][][]
%[][][][][][][][][][][][][][][][][][][][][][][][]
i=max(i);%

for i=1:1:iend;
itemp=i;%
%break;
end
end
clear iend;

clear i;%

%[][][][][][][][][][][][][][][][][][][][][][][][]
clear output;
output(1:1301,1)=uper1(:,1);
output(1:1301,2)=uper1(:,2);
output(1301:2601,1)=down1(:,1);
output(1301:2601,2)=down1(:,2);
%[][][][][][][][][][][][][][][][][][][][][][][][]
clear itemp;
clear uper;
clear uper1;
clear down;
clear down1;
clear b1;
clear b2;
clear b3;
clear b4;
clear inner;
%end