This preview shows pages 1–2. Sign up to view the full content.
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) else % Bad input - return to Matlab command prompt fprintf('Illegal input - please rerun the program and enter y or n.\n') t = v = return end v = sqrt(m*g/c)*tanh(sqrt(g*c/m)*t) Sheet1 Page 2 % Determine if terminal velocity was reached % This is the most typical use of an if statement tol = 1e-4 npts = size(v,1) dv = abs(v(npts,1)-v(npts-1,1)) if dv < tol disp('Terminal velocity was researched.') else disp('Terminal velocity was not reached.') end...
View Full Document
- Spring '09