# HW2 - %Author Richard Chang Úte%Assignment 2%Purpose To...

This preview shows pages 1–2. Sign up to view the full content.

%Author: Richard Chang %Date: 10/7/2010 %Assignment: 2 %Purpose: To Learn fprintf('Problem 1:\n') a = input('a='); b = input ('b='); x = a:(b-a)/100:b; y = (exp(x) + exp(-x))/2; plot (x,y) fprintf('Problem 2:\n') A = input('Enter Matrix A with size(p x p)='); b = input('Enter Vector b with size (p x 1)='); x = A\b; M = [(1:length(x))',x]; fprintf('x%1.0f = %1.2f\n',M') %this is to do the second iteration for the 6x6 matrix for #2 A = input('Enter Matrix A with size(p x p)='); b = input('Enter Vector b with size (p x 1)='); x = A\b; M = [(1:length(x))',x]; fprintf('x%1.0f = %1.2f\n',M') fprintf('Problem 3:\n') H = load('Homework2Data.txt'); x = H(:,1); y = H(:,2); means = y - ones(size(y))*mean(y) plot(x,u) %%%%%%%%%%%%%%%%%%ANSWERS%%%%%%%%%%%%%%%%%%%%%%%% % Problem 1: % a=-10 % b=10 % Problem 2: % Enter Matrix A with size(p x p)=[8 4 2; 5 2 2; 7 2 1] % Enter Vector b with size (p x 1)=[7;2;7] % x1 = 1.17 % x2 = 0.75 % x3 = -2.67 % Enter Matrix A with size(p x p)=[8 5 3 1 4 6; 4 2 6 9 3 3; 6 3 8 9 5 8; 2 3 1

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 10/11/2011 for the course GEN_ENG 205-1 taught by Professor Nocedal during the Fall '07 term at Northwestern.

### Page1 / 3

HW2 - %Author Richard Chang Úte%Assignment 2%Purpose To...

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

View Full Document
Ask a homework question - tutors are online