making different signals equal in length
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Lisa Justin
el 3 de Dic. de 2012
Comentada: chaitanya
el 27 de Feb. de 2016
Hi, I am working with a set of data and i need all of them to be the same length. how can i do this?
0 comentarios
Respuesta aceptada
Jan
el 3 de Dic. de 2012
It depends. As said already you can crop the longer ones, pad the shorter ones or apply an interpolation. For the latter there are linear, cubic, spline, bsline, trigonometric and more complicated interpolation methods.
2 comentarios
Walter Roberson
el 1 de Jun. de 2015
Find the maximum of their lengths, say maxlen. Then for each,
ifft(fft(TheSignal),maxlen)
Más respuestas (2)
Walter Roberson
el 3 de Dic. de 2012
S1 = size(FirstMatrix);
S2 = size(SecondMatrix);
MaxS = max(S1, S2);
if MaxS(1) > S1(1); FirstMatrix(end+1:MaxS(1), :) = 0; end
if MaxS(2) > S1(2); FirstMatrix(:, end+1:MaxS(2)) = 0; end
if MaxS(1) > S2(1); SecondMatrix(end+1:MaxS(1), :) = 0; end
if MaxS(2) > S2(2); SecondMatrix(:, end+1:MaxS(2)) = 0; end
You can simplify this a bit if you are using vectors and you know the orientation of the vectors.
3 comentarios
Muruganandham Subramanian
el 3 de Dic. de 2012
Can you provide the data? you can do it by adding zeros, ones, any desirable data to the data having minimum sizes from data having maximum sizes by initializing max. data length caustiously..
0 comentarios
Ver también
Categorías
Más información sobre Splines en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!