Effacer les filtres
Effacer les filtres

How to get the central data of a matrix?

1 vue (au cours des 30 derniers jours)
Jason Jeong
Jason Jeong le 25 Avr 2017
Commenté : Jason Jeong le 25 Avr 2017
The short of it is that I need the middle 1024x1 data points in a 1075x1 set.
Long story, I have a signal (1024x1) that is filtered/convoluted with a lowpass filter that gives me a 1024x1/1075x1 filtered signal. From graphing all three (black-original, blue-convolution, red-filter) it looks like the convolution gives me a 1075x1 signal that is shifted from the original signal by the extra data points from the filtering. The filter function is supposed to give me the same size output as the input but it looks like it's just cutting off the last 51 data points and not really centering it.
My question is how do I cut the first and last 25 data points from the 1075x1 matrix so that when I graph the original signal with the filtered signal, it is centered correctly.

Réponse acceptée

Joseph Cheng
Joseph Cheng le 25 Avr 2017
Modifié(e) : Joseph Cheng le 25 Avr 2017
you'd use the parameter 'same' in the convolution function
x = [0 1 2 3 4 5 4 3 2 1 0]
conv(x,[0 1 0],'same')
otherwise if you know the length of the convoluted signal giving 25 extra points you can just delete them by
outputans([1:25 end-24:end])=[];
  1 commentaire
Jason Jeong
Jason Jeong le 25 Avr 2017
Thanks for the help!

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by