Smoothing curve with duplicate values using pchip

1 次查看(过去 30 天)
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!

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by