How to perform a truncated SVD
Mostrar comentarios más antiguos
I am trying to solve a system of equations using a truncated SVD (m_trunc) after doing a regular SVD. Using the picard plot, I have a new Sk of k=10. Anyone familiar with SVD and truncated SVD, is this the proper way to perform a truncated SVD in Matlab? Any input appreciated, thanks!
%data
y=[0.0250 0.0750 0.1250 0.1750 0.2250 0.2750 0.3250 0.3750 0.4250 0.4750 0.5250 0.5750 0.6250 0.6750 0.7250 0.7750 0.8250 0.8750 0.9250 0.9750]';
d=[0.2388 0.2319 0.2252 0.2188 0.2126 0.2066 0.2008 0.1952 0.1898 0.1846 0.1795 0.1746 0.1699 0.1654 0.1610 0.1567 0.1526 0.1486 0.1447 0.1410]';
j=20;
dx=(1/20);
x=y;
x=x';
%create the G matrix
for k=1:20
for i=1:20
G(k,i)=(x(k)*exp(-x(k)*y(i))*dx);
end
end
d_sum=sum(G);
%SVD
[U,S,V] = svd(G);
%the MP psuedo inverse
m=pinv(G)*d;
s_di=diag(S);
model=V*((U'*d)./diag(S)); %testing
con=cond(G); %ill-conditioned
%Picard plot
figure(1)
clf
bookfonts
semilogy(diag(S),'ko');
xlabel('i')
ylabel('s_i')
%truncated
m_trunc=V(:,1:10)*((U(:,1:10)'*d)./s_di(1:10,1));
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Linear Algebra en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

