Smoothing curve with duplicate values using pchip

1 view (last 30 days)
I have been using pchip interpolation to smooth curves plotted from data points. This has worked fine except I can't figure out how to smooth the curve when there are duplicate x values. This is what I have now:
Pressure27 = TC27Data.Pressurepsi;
Efficiency27 = TC27Data.Efficiency;
[xUnique, ia, ic] = unique(Pressure27);
yMeans = accumarray(ic, Efficiency27, [], @mean);
xq27 = [1500:.001:1250];
yqp27 = pchip(xUnique,yMeans,xq27);
plot(xUnique,yMeans,'linewidth',2);
This is mostly not my original code, I found it on this forum here.
This successfuly plots the averaged data point where there were duplicate values, however the curve that plots is not as smooth as I would like it, I want to get rid of the linear jagged edges. How can I use pchip here to smooth the curve? Thanks!

Answers (0)

Categories

Find more on Interpolation 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!