Fitting function to ecdf plot
Show older comments
Hi
I am looking for a way to fit function g to the ecdf-plot I produce as follows.
T = 1000;
cens = (y>T);
ecdf(y,'Function','survivor', ...
'Censoring',cens,'Bounds','on');
g=fittype('a-b*exp(-c*x)');
I would like to use the bounds determined in ecdf as a weighting factor "w" for the fit.
I tried
h=gcf;
dataObjs = findobj(gcf,'-property','YData');
dmy3=dataObjs.XData;
x=dmy3';
dmy4=dataObjs.YData;
y2=dmy4';
g=fittype('a-b*exp(-c*x)');
f=fit(x,y2,g,'StartPoint',[[ones(size(x)), -exp(-x)]\y2; 1]);
hold on;
Though this is giving me the upper bounds as xData and yData.
Thanks in advance for any suggestion.
Peter
Accepted Answer
More Answers (0)
Categories
Find more on Exploration and Visualization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!