Code covered by the BSD License

# Reliable and Roubst Design

### Stuart Kozola (view profile)

21 Jan 2008 (Updated )

MATLAB Code used in the Jan 2008 Digest Article

cumprobPlot(cost)
```function cumprobPlot(cost)
%CUMPROBPLOT    Create plot of datasets and fits
%   CUMPROBPLOT(COST)
%   Creates a plot, similar to the plot in the main distribution fitting
%   window, using the data that you provide as input.  You can
%   apply this function to the same data you used with dfittool
%   or with different data.  You may want to edit the function to
%   customize the code and this help message.
%
%   Number of datasets:  1
%   Number of fits:  0

% This function was automatically generated on 08-Jan-2008 09:58:32

% Data from dataset "Normalized Pasenger Discomfort":
%    Y = cost

% Force all inputs to be column vectors
cost = cost(:);

% Set up figure to receive datasets and fits
f_ = clf;
figure(f_);
set(f_,'Units','Pixels','Position',[654 334 680 469.45]);
legh_ = []; legt_ = {};   % handles and text for legend
ax_ = newplot;
set(ax_,'Box','on');
hold on;

% --- Plot data originally in dataset "Normalized Pasenger Discomfort"
t_ = ~isnan(cost);
Data_ = cost(t_);
[Y_,X_] = ecdf(Data_,'Function','cdf'...
);  % compute empirical function
h_ = stairs(X_,Y_);
set(h_,'Color',[0.333333 0 0.666667],'LineStyle','-', 'LineWidth',1);
xlabel('Data');
ylabel('Cumulative probability')
legh_(end+1) = h_;
legt_{end+1} = 'Normalized Pasenger Discomfort';

% Nudge axis limits beyond data limits
xlim_ = get(ax_,'XLim');
if all(isfinite(xlim_))
xlim_ = xlim_ + [-1 1] * 0.01 * diff(xlim_);
set(ax_,'XLim',xlim_)
end

x_ = linspace(xlim_(1),xlim_(2),100);

hold off;
leginfo_ = {'Orientation', 'vertical'};
h_ = legend(ax_,legh_,legt_,leginfo_{:}); % create and reposition legend
set(h_,'Units','normalized');
t_ = get(h_,'Position');
t_(1:2) = [0.155637,0.741541];
set(h_,'Interpreter','none','Position',t_);
```

Contact us