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

📄 plotsnr.m

📁 Sparse Signal Representation using Overlapping Frames (matlab toolbox)
💻 M
字号:
function PlotSNR(SNRtot,History,Mplot)
% PlotSNR   Plot development in SNR after each iteration during training
%
% PlotSNR(SNRtot,History,M);% -----------------------------------------------------------------------------------
% Arguments:
%  SNRtot    - an array of size 1xItNo or (Mdat+1)xItNo which stores the SNR or PSNR
%              after each time Vector Selection is done. ItNo is
%              number of iterations done 
%  History   - a character array telling when the frame was made and trained
%  M         - which of the signal to plot SNR for, 0 (or omitted) is total for all
% ------------------------------------------------------------------------------------

% ------------------------------------------------------------------------------------
% Copyright (c) 2000.  Karl Skretting.  All rights reserved.
% Hogskolen in Stavanger (Stavanger University), Signal Processing Group
% Mail:  karl.skretting@tn.his.no   Homepage:  http://www.ux.his.no/~karlsk/
% 
% HISTORY:  dd.mm.yyyy
% Ver. 1.0  22.08.2000  KS  made function
% Ver. 1.1  12.12.2000  KS  some changes
% Ver. 1.2  28.11.2002  KS: moved from ..\Frames to ..\FrameTools
% Ver. 1.3  03.01.2003  KS: do not need History
% ------------------------------------------------------------------------------------

Mfile='PlotSNR';
MaxFactor=2;      % if 0 it will not be used

if (nargin<2); History=0; end;
if (nargin<3); Mplot=0; end;
if (Mplot<0); Mplot=abs(Mplot); end;
Mplot=floor(Mplot);

[M,L]=size(SNRtot);       % M=Mdat+1, L=ItNo
% we plot row M of SNRtot, that is the total
if Mplot; M=min(Mplot,M); end;
if L<8; 
   for k=1:L
      disp([Mfile,': After iteration ',int2str(k),...
            ' SNR is ',num2str(SNRtot(M,k),4)]);
   end
   return; 
end          % nothing to plot

if MaxFactor                 
   I=find(SNRtot(M,:) < (max(SNRtot(M,:))/MaxFactor));
   if length(I)
      SNRtot(M,I)=max(SNRtot(M,:))/MaxFactor;
   end
end

clf;
hold on;
plot(1,SNRtot(M,1),'*r');
plot((1:L),SNRtot(M,1:L),'-b');
%
V=axis;
if isstr(History)
    s1='Star and solid line after update of W.';
    FromLeft=0.10;
    FromTop=0.02; 
    H=text((1-FromLeft)*V(1)+FromLeft*V(2),FromTop*V(4)+(1-FromTop)*V(3),s1);
    set(H,'FontSize',8);
    set(H,'VerticalAlignment','bottom');
    s1=['First SNR=',num2str(SNRtot(M,1),4),', final SNR=',num2str(SNRtot(M,L),4),...
            ' and best SNR=',num2str(max(SNRtot(M,:)),4)];
    FromTop=0.06;
    H=text((1-FromLeft)*V(1)+FromLeft*V(2),FromTop*V(4)+(1-FromTop)*V(3),s1);
    set(H,'FontSize',8);
    set(H,'VerticalAlignment','bottom');FromTop=0.10;
    if size(History,1)<8
        H=text((1-FromLeft)*V(1)+FromLeft*V(2),FromTop*V(4)+(1-FromTop)*V(3),History);
    else
        H=text((1-FromLeft)*V(1)+FromLeft*V(2),FromTop*V(4)+(1-FromTop)*V(3),...
            char(History(1:6,:),' ... and more.'));
    end
    set(H,'FontSize',8);
    set(H,'VerticalAlignment','bottom');
else
    s1=['First SNR=',num2str(SNRtot(M,1),4),', final SNR=',num2str(SNRtot(M,L),4),...
            ' and best SNR=',num2str(max(SNRtot(M,:)),4)];
    disp(s1);
end
%   
title(['Signal to Noise Ratio  (',Mfile,': ',date,')']);
ylabel('SNR');
xlabel('Iteration number');
hold off;
% set(gcf,'PaperType','a4letter');
% set(gcf,'Position',[200 250 1000 700]);

return

⌨️ 快捷键说明

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