📄 plotprob.m
字号:
% plotprob.m% function plotprob(x,Qx,xlab,ylab,nor)% This program plots a set of right-tail probabilities % (complementary cumulative distribution function) on normal% probability paper.%% Input Parameters:%% x - Real column vector of x values for desired % right-tail probabilities% Qx - Real column vector of corresponding % right-tail probabilities% xlab - Label for x axis (enclose in single quotes)% ylab - Label for y axis (enclose in single quotes)% nor - Set equal to 1 for Gaussian right-tail probability% to be plotted for comparison, and 0 otherwise%% Verification Test Case:%% The inputs x=[-5:0.01:5]';Qx=0.5*Q(x)+0.5*Q(x/sqrt(2));xlab='x';% ylab='Right-tail Probability';nor=1; should produce Figure 2.4.%% Set up y-axis values. y=[0.0001 0.001 0.01 0.1 0.3 0.5 0.7 0.9 0.99 0.999 0.9999]';% Set up x-axis limits. xmax=Qinv(min(y));% Warp y values for plotting. m=(2*min(y)-1)/(2*xmax); Y=m*Qinv(Qx)+0.5;% Check to see if Q(x) (Gaussian right-tail probability)% is to be plotted. if nor==1 xnor=[-xmax:0.01:xmax]'; ynor=m*xnor+0.5; plot(x,Y,'-',xnor,ynor,'--') else plot(x,Y) end xlabel(xlab) ylabel(ylab) axis([-xmax xmax min(y) max(y)]);% Determine y tick mark locations by warping. Ytick=m*Qinv(y)+0.5;% Set up y axis labels. t=['0.0001';' 0.001';' 0.01';' 0.1';' 0.3';' 0.5';... ' 0.7';' 0.9';' 0.99';' 0.999';'0.9999']; set(gca,'Ytick',Ytick) set(gca,'Yticklabels',t) grid
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -