フィルターのクリア

how can i apply lowpass filter to this code

1 回表示 (過去 30 日間)
Mehmet Özgür Güzel
Mehmet Özgür Güzel 2022 年 9 月 3 日
回答済み: Star Strider 2022 年 9 月 3 日
% generate a waveform
f0 =100;
fs=1000;
pw = 0.1;
pri = 1;
npulses = 100;
s = cos(2*pi*f0*(0:1/fs:pw)); % it can be any other waveform of your choice
s(round(fs*pri)) = 0; % PRI
s = repmat(s, npulses, 1); % npulses
% echo: delayed signal
tau = 0.3;
ntau = round(fs*tau);
amp = 0.5;
e = amp* circshift(s, ntau);
% add noise
sigma = 0.1;
r = s + e + sigma*randn(size(s));
y = pulsint(r);
plot((0:length(s)-1)/fs, r)

採用された回答

Star Strider
Star Strider 2022 年 9 月 3 日
There are several approaches. This one uses the lowpass function —
% generate a waveform
f0 =100;
fs=1000;
pw = 0.1;
pri = 1;
npulses = 100;
s = cos(2*pi*f0*(0:1/fs:pw)); % it can be any other waveform of your choice
s(round(fs*pri)) = 0; % PRI
s = repmat(s, npulses, 1); % npulses
% echo: delayed signal
tau = 0.3;
ntau = round(fs*tau);
amp = 0.5;
e = amp* circshift(s, ntau);
% add noise
sigma = 0.1;
r = s + e + sigma*randn(size(s));
y = pulsint(r);
Fn = fs/2
Fn = 500
Fco = 125; % Choose A Frequency > 0 & < fs/2
r_filt = lowpass(r, Fco, fs, 'ImpulseResponse','iir'); % Design An Elliptic Filter & Filter 'r'
figure
plot((0:length(s)-1)/fs, r)
title('Original')
figure
plot((0:length(s)-1)/fs, r_filt)
title('Filtered')
Thje amplitude is less in the filtered signal because signal energy has been removed. Use the fft or pspectrum function on both signals to see the effect of filtering.
.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBartlett についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by