Smoothing curve with duplicate values using pchip

1 Ansicht (letzte 30 Tage)
Rosemaryl21
Rosemaryl21 am 10 Aug. 2020
Bearbeitet: Rosemaryl21 am 10 Aug. 2020
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!

Antworten (0)

Kategorien

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by