chen310hw2 - Ch E 310 Fall 2008 - Homework 2 Solutions...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Ch E 310 – Fall 2008 - Homework 2 Solutions hw2_1.m % set up vectors with two sets of parameters F1(1) = 500; F2(1) = 1000; yin(1) = 0.1; xin(1) = 0; K(1) = 4; F1(2) = 250; F2(2) = 600; yin(2) = 1.0; xin(2) = 0.01; K(2) = 1.5; % loop to cover both parameter sets for n = 1:2 % initialize a 7-by-7 matrix of zeros A = zeros(7); % set up first row A(1,[1:2]) = [F2(n)*K(n)+F1(n) -F2(n)*K(n)]; % loop to create rows 2 through 6 since they shift and repeat for i = 2:6 A(i,[i-1:i+1]) = [-F1(n) F2(n)*K(n)+F1(n) -F2(n)*K(n)]; end % set up last row A(7,[6:7]) = [-F1(n) F2(n)*K(n)+F1(n)]; % initialize b vector b = zeros(7,1); % define the two non-zero terms in b b(1) = F1(n)*yin(n); b(7) = F2(n)*xin(n); format long ; % show more digits y = A\b % matrix solve x = K(n)*y % calculate corresponding x values from equation figure(n) % open a new figure window semilogy((1:7),y,(1:7),x) % plot results with y-axis on log scale end
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Output: >> hw2_1 y = 0.01249999478459 0.00156249413267 0.00019530655118 0.00002440810349
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This homework help was uploaded on 03/26/2008 for the course CHEM E 310 taught by Professor Clapp during the Fall '07 term at Iowa State.

Page1 / 4

chen310hw2 - Ch E 310 Fall 2008 - Homework 2 Solutions...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online