This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: % Verify that a filename was entered if isempty(filename) fprintf('No file name entered - aborting program.\n') return end data = load(filename) nrows = size(data,1) m = data(1,1) g = data(2,1) c = data(3,1) t = data(4:nrows,1) otherwise % Bad input - return to Matlab command prompt fprintf('Illegal input - please rerun the program and enter y or n.\n') t = v = return end Sheet1 Page 2 v = sqrt(m*g/c)*tanh(sqrt(g*c/m)*t) % Determine if terminal velocity was reached tol = 1e-4 npts = size(v,1) dv = abs(v(npts,1)-v(npts-1,1)) % How can we use a switch statement to print out the correct message? % We need to turn dv into either a string or an integer. if dv < tol message = 1 else message = 2 end switch message case 1 disp('Terminal velocity was researched.') case 2 disp('Terminal velocity was not reached.') end...
View Full Document
This note was uploaded on 09/05/2011 for the course EGM 3344 taught by Professor Raphaelhaftka during the Spring '09 term at University of Florida.
- Spring '09