Is there an easy way to remove points from a signal which can be restored by interpolation
9 views (last 30 days)
Show older comments
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')
3 Comments
Walter Roberson
on 27 May 2022
Have you considered using spline()? It will automatically create a piecewise cubic polynomial
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Spline Construction 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!