How to get the central data of a matrix?

조회 수: 2 (최근 30일)
Jason Jeong
Jason Jeong 2017년 4월 25일
댓글: Jason Jeong 2017년 4월 25일
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.

채택된 답변

Joseph Cheng
Joseph Cheng 2017년 4월 25일
편집: Joseph Cheng 2017년 4월 25일
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])=[];

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by