HW2 - %Author: Richard Chang %Date: 10/7/2010 %Assignment:...

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

View Full Document Right Arrow Icon
%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
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

HW2 - %Author: Richard Chang %Date: 10/7/2010 %Assignment:...

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

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