# Is there an easy way to remove points from a signal which can be restored by interpolation

3 views (last 30 days)
Jonas on 24 May 2022
Edited: Jonas on 8 Jun 2022
Dear community,
I gues there is already a solutio nout there, but I am not finding the right key wordsw to google it myself:
Imaging having a simpel signal like a straight line, which has 1000 sample points. the lines slope and extent can bestored easily by keeping only the first and last point and inteprolating the others.
going from there we have a piecewise linear signal, which can be stored by e.g. by keeping the maxima and minima.
starting the problems here, how a bout a piecewise linear line with increasing slope.
How can i choose automatically the most important points together with a minimum spacing between points to keep slow changing components and restore the rest of the signal using a specific interpolation method, of course not exact but with a certain error.
This is some kind of compression question and reminds me also a bit of some multi rate signal processing back in the days.
i know of parametrical representation or representation by some transformation coefficients, but how to do something similar directly by storing point coordinates, interpolation method and e.g. interpolation rate
I try to depict it in some simple plots, top we can see the sparse representation using only few points, at the bottom the interpolated variant. How to get from bottom values to top values?
sorry for the long question
best regards
Jonas
close all;
interpT=0:0.5:10;
method='pchip';
% a line
aSparseLine=[1 3];
aSparseLineT=[0 10];
anInterpLine=interp1(aSparseLineT,aSparseLine,interpT,method,NaN);
figure
subplot(2,1,1);
plot(aSparseLineT,aSparseLine,'x');
title('sparse (aim to be saved)')
subplot(2,1,2);
plot(interpT,anInterpLine,'x')
title('full (from where we start)')
% piecewise line
piecewiseLines=[1 3 -4 -1];
piecewiseLinesT=[0 2 6 9];
anInterpPiecewiseLines=interp1(piecewiseLinesT,piecewiseLines,interpT,method,NaN);
figure
subplot(2,1,1);
plot(piecewiseLinesT,piecewiseLines,'x');
title('sparse (aim to be saved)')
subplot(2,1,2);
plot(interpT,anInterpPiecewiseLines,'x')
title('full (from where we start)')
% nasty piecewise line (given sparse representation not on interpolation t -> denser interpolation)
piecewiseLines=[1 3 -4 -1 0];
piecewiseLinesT=[0 2.2 2.6 3.4 9];
newInterpT=0:0.2:10;
anInterpPiecewiseLines=interp1(piecewiseLinesT,piecewiseLines,interpT,method,NaN);
anInterpPiecewiseLinesDenser=interp1(piecewiseLinesT,piecewiseLines,newInterpT,method,NaN);
figure
subplot(2,1,1);
plot(piecewiseLinesT,piecewiseLines,'x');
title('sparse (aim to be saved)')
subplot(2,1,2);
plot(newInterpT,anInterpPiecewiseLinesDenser,'x')
title('full (from where we start)')
hold on;
plot(interpT,anInterpPiecewiseLines,'x')
Jonas on 8 Jun 2022
Edited: Jonas on 8 Jun 2022
@Jan I'm asking to remove as many knots from the as possible since the interpolation itself will often suffice to reproduce the original signal (with many knots).
I think knot free interpolation posted below is what I am searching for, but is there also a ways to adjust to another interpolation method?
the background of this question is actually a completly practical question. I created a gui which lets the user itself place points on a spectral representation to mark the fundamental frequency. since this can be a long process, there is also the possibility to add those points using matlab's pitch() function. Since this function has its flaws and the user should be able to manually correct those errors, it would be nice to have fewer points but shape preserving, since the user has to click each point individually to delete.
I am asking for other interpolation method than spline since often I find the pchip method would be easier to handle for hard transitions and breaks in f0

Bruno Luong on 27 May 2022
This Free knot spline FEX can acoomplish what you ask for.
Jonas on 8 Jun 2022
nice to see, thanks! is there a way to adapt this to other interpolation types?

R2022a

### Community Treasure Hunt

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

Start Hunting!

Translated by