I am having 20 signals each of 24sec.I want to split it into 2 equal halves.(for example if i am having 20 signals it should be divided into two halves of 40 signals) i tried with indexing method i.e. i have used (1:end/2). It displays only the first half signal. It is not considering the second half.Please suggest me how to split a signal.

 채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 10월 26일

0 개 추천

You are half done. The other half is in (end/2:end)

댓글 수: 3

Walter Roberson
Walter Roberson 2011년 10월 26일
If you use end/2 as the endpoint of the first signal and the start of the next, then one sample will be duplicated between the two.
pravena duplex
pravena duplex 2011년 10월 26일
I tried with that command it displays only the first half of the signal i.e, I'm getting only 20 signals whereas I should get 40.
Fangjun Jiang
Fangjun Jiang 2011년 10월 26일
Walter had a good point! If a=1:40, then a(1:end/2) and a(end/2:end) have one data sample over-lapped. If a=1:41, a(end/2:end) and a(end/2:end) work out correctly (assume second half has 1 more data sample). But still, it is better to take care of it specifically using round().

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Wayne King
Wayne King 2011년 10월 26일

0 개 추천

The question is how do you want to split them. It sounds like you want them into the first half and second half. Assuming your signals are in columns of your matrix.
X = randn(100,20);
X1 = X(:,1:size(X,2)/2);
X2 = X(:,size(X,2)/2+1:end);

댓글 수: 1

pravena duplex
pravena duplex 2011년 10월 26일
I tried with that command but it displays only the first half of the signal i.e, I'm getting only 20 signals whereas I should get 40.(Tested with 20 signals)

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Signal Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by