emplot.m

来自「极值理论中各种函数及图像的程序。matlab实现。」· M 代码 · 共 55 行

M
55
字号
function c=emplot(data,axs),
%Plots empirical distribution of a sample.
%
%USAGE: emplot(data,axs)
%
% data: Data vector
%  axs: Can be 'lin', 'x' or not entered
%          if not entered: Log scaling on both axes
%          if 'lin': Linear scaling on both axes
%          if 'x': Log scaling on x axis
warning off

if nargin==1,
   axs='both';
end

if strcmp(axs,'both')|strcmp(axs,'x'),
   disp(' If there are negative values in the data, they will be omitted while taking logarithm');
   
end

data=sort(data);
ypoints=1-ppoints(data);
if strcmp(axs,'lin'),
    plot(data,ypoints,'.');
    
    xlabel('x');
    ylabel('1-F(x)');
   
    
elseif strcmp(axs,'x')
    semilogx(data,ypoints,'.')
    set(gca,'xticklabel',get(gca,'xtick'));
    set(gca,'xtickmode','manual');                        
    xlabel('x (on log scale)');

    xlabel('x (on log scale)');
    ylabel('1-F(x)');
    
elseif strcmp(axs,'both')
    loglog(data,ypoints,'.')
    set(gca,'yticklabel',get(gca,'ytick'));
    set(gca,'ytickmode','manual');                        
    set(gca,'xticklabel',get(gca,'xtick'));
    set(gca,'xtickmode','manual');                        
    xlabel('x (on log scale)');
    ylabel('1-F(x) (on log scale)');
    
else
    disp('ERROR: Second input should be one of {''lin'',''x'',''both''} ')
    return
 end
 set(gca,'fontsize',8);
 
 warning on

⌨️ 快捷键说明

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