% This Matlab program is used in % MATH 365 - Computational Fluid Dynamics at % James Madison University. This program was % written by James Sochacki of the % Department of Mathematics at James Madison % University as part of the NSF Grant - % A Collaborative Computational Science Program % between JMU and North Carolina Central University. % Jim Sochacki % Department of Mathematics % James Madison University % Harrisonburg, VA 22807 % jim@math.jmu.edu % This Matlab Routine reads in a sequence of 1D data sets and animates the data % in a sequence of frames. The data sets must be in files with a filename of the % form NAME***** where ***** is a 5 digit integer. For example, your first % filename might be input00000 so that your starting step is 0. Your next file % might be input00005 so that your step size is 5. Your last data set might be % input00050 so that your last step is 50. Each data set might contain 81 data % points so how many data points would be 81. name = input(' What is the base file name NAME of your data sets? ','s') nxgrid = input(' How many data points are in each data set? ') nstart = input(' What is the starting step (integer) for your data sets ? ') nstep = input(' What is the step size (integer) between your data sets? ') nend = input(' What is the last step (integer) for your data steps? ') ymin = input(' What is the minimum value for the plots of your data sets? ') ymax = input(' What is the maximum value for the plots of your data sets? ') for i = nstart:nstep:nend fprintf('%d',i); filename = sprintf('%s%5.5d',name,i); fid = fopen(filename,'r'); % a = fread(fid,nxgrid,'single'); a = fscanf(fid,'%f',nxgrid); x = 1:nxgrid; plot(x,a); axis([1 nxgrid ymin ymax]);grid; pause(0.25); end;