How can i reconstruct a signal?

i have a signal (vector) with blanks (parts with zero value) and i want reconstruct the signal by fill the gaps with random parts of the main signals,how can i do this?

 Respuesta aceptada

Image Analyst
Image Analyst el 22 de Mzo. de 2013

0 votos

Why not use interp1() or TriScatteredInterp(), or if it's an image, roifill()? Those all use neighboring values to fill in the blanks. Why would you want to use random parts of the signal to fill in the gaps? I don't see the sense in that.

3 comentarios

Image Analyst
Image Analyst el 22 de Mzo. de 2013
You can try this:
% Generate some sample data.
s = rand(1,30)
% Make blank between 10 and 20 and 26 and 29
s(10:20) = 0;
s(26:29) = 0
% Now do the task.
% Find the blank elements
blankElements = s == 0
numberOfBlanks = sum(blankElements)
nonBlankS = s(~blankElements) % just the non-zero elements
% Get random indexes.
elementsToTake = randperm(length(nonBlankS), numberOfBlanks)
% Assigm the elements of the non-blank s to the blank elements.
s(blankElements) = nonBlankS(elementsToTake)
Samuel Tarazona
Samuel Tarazona el 3 de Jun. de 2021
Dear Sir, I would like to know how I can apply your script to the case in the figure above. The data I reconstructed is in the middle.
Thanks in advance!
Image Analyst
Image Analyst el 3 de Jun. de 2021
Looks like you already applied it. If you need more help, post your code and screenshot in a new question.

Iniciar sesión para comentar.

Más respuestas (1)

Dimitris Malamas
Dimitris Malamas el 22 de Mzo. de 2013

0 votos

Thank you for the answer. I want to use random parts of the signal because it is a biosignal and this is the right way to fill the gaps.

Etiquetas

Preguntada:

el 22 de Mzo. de 2013

Comentada:

el 3 de Jun. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by