フィルターのクリア

Fit a signal into smaller window while maintaiing proportion

1 回表示 (過去 30 日間)
John
John 2013 年 3 月 16 日
I have a random signal of 2048 points. There are several peaks spread out (maybe 10). The rest are all zeros or have very low amplitude.
I want to squeeze this signal into a 512 signal window maintaining all the peaks and data with less of the zeros or low amplitude data.
How can I do this in Matlab?

採用された回答

Image Analyst
Image Analyst 2013 年 3 月 16 日
You can sort and then keep just the 512 with the highest values:
data = rand(1, 2048);
subplot(2, 1, 1);
plot(data);
% Sort the data
[sortedData, sortIndices] = sort(data, 'descend');
% Find the first 512 - they will be the greatest value.
elementsToKeep = sortIndices(1:512);
% Get them back in their original order:
elementsToKeep = sort(elementsToKeep);
% Extract those elements
extractedData = data(elementsToKeep);
subplot(2, 1, 2);
plot(extractedData);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
That's one way to do it.
  1 件のコメント
John
John 2013 年 3 月 16 日
Thanks, it worked perfectly!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatched 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