function mySurvivor(y)
%MYSURVIVOR Create plot of datasets and fits
% MYSURVIVOR(Y)
% 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: 1
% This function was automatically generated on 10-Aug-2006 14:33:14
% Data from dataset "Experimental Data":
% Y = y
% Force all inputs to be column vectors
y = y(:);
% Set up figure to receive datasets and fits
f_ = clf;
figure(f_);
set(f_,'Units','Pixels','Position',[318 118.5 680 468.45]);
legh_ = []; legt_ = {}; % handles and text for legend
ax_ = newplot;
set(ax_,'Box','on');
hold on;
% --- Plot data originally in dataset "Experimental Data"
t_ = ~isnan(y);
Data_ = y(t_);
[Y_,X_] = ecdf(Data_,'Function','survivor'...
); % compute empirical function
h_ = stairs(X_,Y_);
set(h_,'Color',[0.333333 0 0.666667],'LineStyle','-', 'LineWidth',1);
xlabel('Data');
ylabel('Survivor function')
legh_(end+1) = h_;
legt_{end+1} = 'Experimental Data';
% 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);
% --- Create fit "Weibull Fit"
% Fit this distribution to get parameter values
t_ = ~isnan(y);
Data_ = y(t_);
% To use parameter estimates from the original fit:
% p_ = [2140.21017213, 4.326698938342];
p_ = wblfit(Data_, 0.05);
y_ = wblcdf(x_,p_(1), p_(2)); % compute cdf
y_ = 1 - y_; % convert to survivor function
h_ = plot(x_,y_,'Color',[1 0 0],...
'LineStyle','-', 'LineWidth',2,...
'Marker','none', 'MarkerSize',6);
legh_(end+1) = h_;
legt_{end+1} = 'Weibull Fit';
hold off;
h_ = legend(ax_,legh_,legt_,'Location','NorthEast');
set(h_,'Interpreter','none');