plot_lc.m

来自「这是在网上下的一个东东」· M 代码 · 共 73 行

M
73
字号
function plot_lc(rho,eta,marker,ps,reg_param) %% This copy of plot_lc.m was modified to change the appearance of the plot% for publication.  %%PLOT_LC Plot the L-curve. % % plot_lc(rho,eta,marker,ps,reg_param) % % Plots the L-shaped curve of the solution norm %    eta = || x ||      if   ps = 1 %    eta = || L x ||    if   ps = 2 % as a function of the residual norm rho = || A x - b ||.  If ps is % not specified, the value ps = 1 is assumed. % % The text string marker is used as marker.  If marker is not % specified, the marker '-' is used. % % If a fifth argument reg_param is present, holding the regularization % parameters corresponding to rho and eta, then some points on the % L-curve are identified by their corresponding parameter.  % Per Christian Hansen, IMM, 12/29/97.  % Set defaults. if (nargin==2), marker = 'k-'; end  % Default marker. if (nargin < 4), ps = 1; end       % Std. form is default. np = 10;                           % Number of identified points.  % Initialization. if (ps < 1 | ps > 2), error('Illegal value of ps'), end n = length(rho); ni = round(n/np);  % Make plot. loglog(rho(2:end-1),eta(2:end-1),'k'), ax = axis; if (max(eta)/min(eta) > 10 | max(rho)/min(rho) > 10)   if (nargin < 5)     loglog(rho,eta,marker), axis(ax)   else     loglog(rho,eta,marker,rho(ni:ni:n),eta(ni:ni:n),'x'), axis(ax)     HoldState = ishold; hold on;     for k = ni:ni:n %      text(rho(k),eta(k),num2str(reg_param(k)));     end     if (~HoldState), hold off; end   end else   if (nargin < 5)     plot(rho,eta,marker,'k'), axis(ax)   else     plot(rho,eta,marker,rho(ni:ni:n),eta(ni:ni:n),'kx'), axis(ax)     HoldState = ishold; hold on;     for k = ni:ni:n %      H=text(rho(k),eta(k),num2str(reg_param(k))); %      set(H,'FontSize',18);    end     if (~HoldState), hold off; end   end end H=xlabel('residual norm || G m - d ||_2'); set(H,'FontSize',18);set(H,'LineWidth',1.0);if (ps==1)   H=ylabel('solution norm || m ||_2'); else   H=ylabel('solution semi-norm || L m ||_2'); end set(H,'FontSize',18);set(H,'LineWidth',1.0);H=title('L-curve');set(H,'FontSize',18);set(H,'LineWidth',1.0);

⌨️ 快捷键说明

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