hw11_p02 - if (fid4 < 0) error('could not open...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% To get a first derivatives at each point, % i = 1 --> Second order finite difference % i = 2 ~ n-1 --> Second order central difference % i = n --> Second order backward difference % viscosity = 1.8e-5; y = [0, 0.002, 0.006, 0.012, 0.018, 0.024]; v = [0, 0.287, 0.899, 1915, 3.048, 4.299]; n = length(y); h = 0.002; i = 1; i % open file fid4 = fopen('hw11_p02_answer.txt','a'); % 'wt' means "write text"
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if (fid4 < 0) error('could not open file "hw11_p01_answer.txt"'); end; e v_prime(i) = (-8.0*v(i) + 9.0*v(i+1) - v(i+2))/(6.0*h); fprintf(fid4, 'At y = %10.5f, dv/dy = %10.5f\n', y(i), v_prime(i)); shear_stress(i) = viscosity*v_prime(i); fprintf(fid4, 'At y = %10.5f, shear stress = %10.5f\n', y(i), shear_stress(i)); f fclose(fid4);...
View Full Document

This note was uploaded on 02/22/2010 for the course CHE 348 taught by Professor Chelikowsky during the Spring '08 term at University of Texas at Austin.

Ask a homework question - tutors are online