⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lls_reg.m

📁 Lu decomposition routines in matlab
💻 M
字号:
clear alldisp('  ')disp(' Effect of data perturbations on the solution of the LLS ')disp('  ')% Compute At = 10.^(0:-1:-10)';A = [ ones(size(t))  t   t.^2  t.^3  t.^4  t.^5];% compute SVD of A[U,D,V] = svd(A);sigma = diag(D);% compute exact dataxex     = ones(6,1);bex     = A*xex;for i = 1:10   % data perturbation   deltab   = 10^(-i)*(0.5-rand(size(bex))).*bex;   b        = bex+deltab;   w        = U'*b;   % solution of perturbed linear least squares problem   x        = V * (w(1:6) ./ sigma);   errx(i+1) = norm(x - xex);   errb(i+1) = norm(deltab);endloglog(errb,errx,'*')ylabel(' || x^{ex} - x ||_2 ')xlabel(' || \delta b ||_2 ')disp(' hit return to continue ')pausedisp('  ')disp(' Solution of the regularized LLS ')disp('  ')% Compute At = 10.^(0:-1:-10)';A = [ ones(size(t))  t   t.^2  t.^3  t.^4  t.^5];% compute exact dataxex     = ones(6,1);bex     = A*xex;% data perturbation 0f 0.1%deltab  = 0.001*(0.5-rand(size(bex))).*bex;b       = bex+deltab;% compute SVD of A[U,D,V] = svd(A);sigma = diag(D);w     = U'*b;for i = 0:7   lambda(i+1)  = 10^(-i)   xlambda      = V * (sigma.*w(1:6) ./ (sigma.^2 + lambda(i+1)))   err(i+1)     = norm(xlambda - xex);   res(i+1)     = norm(A*xlambda - b);endloglog(lambda,err,'*')ylabel(' || x^{ex} - x_{\lambda} ||_2 ')xlabel(' \lambda ')         loglog(lambda,res,'o'); hold onloglog(lambda,norm(deltab)*ones(size(lambda)),'-'); hold offylabel(' || A x_{\lambda} - b ||_2 ')xlabel(' \lambda ')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -