How can I plot a smooth ROC curve with non-monotonically ascending points?
2 views (last 30 days)
Show older comments
I'm trying to plot a ROC curve, but the curve has to be smooth. So I'm using the interpolation to make it. However, when I use the 'pchip' function, the line ignores one of these points. I guess it happens due the vector created when I use the linspace function because the coordinates are not all monotonically ascending. Code:
FPRate = [1.0000 0.5349 0.2405 0.1653 0.2199];
TPRate = [0.8288 1.0000 0.9254 0.6190 0.0412];
F = linspace(FPRate(1,1),FPRate(1,5),10000);
T = interp1(FPRate,TPRate,F,'pchip');
plot(F,T,'k');
hold on
plot(FPRate,TPRate,'.','MarkerSize',20);

If I change the code and use max and min values rather than the vector address:
F = linspace(min(FPRate),max(FPRate),10000);
T = interp1(FPRate,TPRate,F,'pchip');
plot(F,T,'k');
hold on
plot(FPRate,TPRate,'.','MarkerSize',20);

The problem here is that the plot doesn't follow the vector address but the values it contains. Is there any way to plot a graph like this one below but in a smooth form?
plot(FPRate,TPRate,'k');
hold on
plot(FPRate,TPRate,'.','MarkerSize',20);

0 Comments
Answers (0)
See Also
Categories
Find more on Smoothing 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!