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

22 lines
353 B
Mathematica
Raw Permalink Normal View History

2022-04-03 18:13:51 +02:00
% Vraag 4
clear all
t=(-0.2:0.1:3)'
B=[ones(size(t)) cos(pi*t) cos(pi/2*t).^2 sin(pi*t) sin(pi/2*t).^2]
b=t.^2
[U, S, V] = svd(B)
diag(S)
r = 3
U1 = U(:,1:r) % orhonormale basis voor Col B
U2 = U(:,r+1:end) % Nul B transpose; staat loodrecht op col B
pCol = U1*U1'*b
pNul = U2*U2'*b
% som v/d beide projecties moet nul zijn.
b- pCol - pNul