function plotfoil() % This is a simple matlab plotting function for use with the % airfoil data files obtained from the % University of Illinois at Urbana-Champaign % % usage: % just type plotfoil, and select a file in the pop-up dialog % ok = 1; while (ok) [dfile,dpath] = uigetfile('*.*',... 'Airfoil Data File Name',... 100,100); if (~(dfile == 0)) fid = fopen([dpath,dfile],'r'); name = fgetl(fid); [pts,count] = fscanf(fid,'%f'); if ( (pts(1) == floor(pts(1))) & (pts(1)>5) ) % "Lednicers" format npts_top = pts(1); npts_bot = pts(2); top = zeros(2,npts_top); bot = zeros(2,npts_bot); tp = pts(3:2+2*npts_top); bt = pts(3+2*npts_top:2+2*npts_top+2*npts_bot); top(:) = tp; bot(:) = bt; figure; set(gcf,'name',name); plot(top(1,:),top(2,:),'w'); hold on plot(bot(1,:),bot(2,:),'w'); axis([0 1 -.5 .5]); title(name); elseif (length(pts)/2 == floor(length(pts)/2)) % "selig" format assumed... npts = length(pts)/2; foil = zeros(2,npts); foil(:) = pts; figure; set(gcf,'name',name); plot(foil(1,:),foil(2,:),'w'); axis([0 1 -.5 .5]); title(name); else % n x y format assumed npts = length(pts)/3; if (npts ~= floor(npts)) error('unrecognized file format'); end foil = zeros(3,npts); foil(:) = pts; figure; set(gcf,'name',name); plot(foil(2,:),foil(3,:),'w'); axis([0 1 -.5 .5]); title(name); end else ok = 0; end end