che310hw1 - Ch E 310 Fall 2008 Homework 1 Solutions hw1_1.m...

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 1 Solutions hw1_1.m % generate matrices using colon operator A(:,1) = [1:5]; A(:,2) = [3:3:15]; A(:,3) = [2:2:10]; B(1,:) = [1:4]; B(2,:) = [8:-1:5]; B(3,:) = [1:2:7]; C = zeros(5,4); % initialize 5x4 matrix C for i = 1:5 % loop over all rows in A for j = 1:4 % loop over all columns in B for k = 1:3 % loop over all columns in A C(i,j) = C(i,j) + A(i,k) * B(k,j); % use formula definition end end end % report output disp( 'this is C based on the formula:' ) C disp( 'this is C based on the MATLAB * operator:' ) C2 = A*B Output: >> hw1_1 this is C based on the formula: C = 27 29 31 33 54 58 62 66 81 87 93 99 108 116 124 132 135 145 155 165 this is C based on the MATLAB * operator: C2 = 27 29 31 33 54 58 62 66 81 87 93 99 108 116 124 132 135 145 155 165
Background image of page 1

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

View Full DocumentRight Arrow Icon
hw1_2.m R = 8.314; E = 1e5; A = 7e16; % define variables rate = @(T) A*exp(-E./(R*T)); % define function handle for k T = linspace(273,400,10); % create temp vector k = rate(T); % calculate rates based on temps
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 note 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 / 3

che310hw1 - Ch E 310 Fall 2008 Homework 1 Solutions hw1_1.m...

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