CS代考计算机代写 matlab %Replicate in Matlab the computations performed in Problem 4 of Workshop 1.

%Replicate in Matlab the computations performed in Problem 4 of Workshop 1.
%0
%Define:
%
A = eye(6);
f = [1, 1, 1, 1, 1, 2]’;
BarA = A + f*f’

%should give
%
%BarA =
%
% 2 1 1 1 1 2
% 1 2 1 1 1 2
% 1 1 2 1 1 2
% 1 1 1 2 1 2
% 1 1 1 1 2 2
% 2 2 2 2 2 5
%
%Compute the inverse of BarA:

S = 1 + f’ * f;
InvBarA = A – f * 1./S * f’;

%Define:

b = [12, 10, 10, 10, 10, 19]’;

%and compute:

x = InvBarA * b

%which should give
%
%x =
%
% 3.0000
% 1.0000
% 1.0000
% 1.0000
% 1.0000
% 1.0000