I would like to filter out some vectors based on a percent of aggregate
이전 댓글 표시
I would like to filter some time series based on their weight of the overall aggregate. The weights are to be calculated based on the derived aggregate/components of the second last element in each vector (x1=20, x2=2, x3=62) The end result would be to extract the complete time series vectors satisfying the threshold. I would also appreciate suggested improvements to the code:
Threshold = *.2*
x1=[5 10 20 15 40 20 25]';
x2=[8 25 15 50 41 2 15]';
x3=[32 42 30 52 33 62 77]';
x=[x1 x2 x3];
sumx=sum(x')';
sumx=[sumx sumx sumx];
perx=x./sumx
perx=perx(4,:);
perx =
0.2381 0.0238 0.7381
Here x2 should be deleted since it falls below the threshold and a new object containing x1 and x3 vectors should get created.
x=[x1 x3];
댓글 수: 3
Image Analyst
2013년 9월 22일
편집: Image Analyst
2013년 9월 22일
How does x2(end-1) being 2 fall below a threshold of 0.2? I don't follow the logic of the sumx and perx part. What's going on there?
Jeff
2013년 9월 22일
Image Analyst
2013년 9월 22일
Yes, see my new edited code below.
채택된 답변
추가 답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!