University-Docs/Documents/School/SEM 1/Octave/december2018.m

30 lines
351 B
Matlab

% Vraag 1
t=1:5;
B = [t;t.^2;t.^3;t.^4;t.^5]
det(B)
%C =B; C(4,:) = B(4,:) +7*B(3,:)
%det(B) -det(C)
C = B(:,end:-1:1)
det(B) - det(C)
% Vraag 2
t =(-1:0.1:1)';
A = [ones(size(t)) t t.^2]
b =(20:-1:0)'-t.^3
x1 = [10;-10.658;0]
x2 = [-10;8.228;2]
(A*x1)'*(b- A*x1)
(A*x2)'*(b- A*x2)
% x1 is de kko
z1 = b - A*x1
z2 = b - A*x2
z1'*z1
z2'*z2