How to create a rectangular pulse in time

I am trying to create a rectangular pulse to use an ideal low pass filter. I am going to multiply a function in the frequency domain by a pulse going up to 1 at 0, and ending at 10,000. I have tried using the rectpulse and rectangular pulse functions but have been unable to succescfully implement the pulse as a function of time. Could someone show me how to do this please?

 采纳的回答

Lets say your audio spectrum is 20,000 elements long. You can make a pulse like this.
bandPassSignal = zeros(1, length(1, audioSpectrum)); % Initialize to all zeros.
bandPassSignal(1:10000) = 1; % First 10,000 elements are now 1.
% Now multiply by the spectrum of your audio signal:
filteredAudioSpectrum = audioSpectrum .* bandPassSignal;
% Now inverse fft and listen to the sound.
filteredTimeDomainSignal = ifft(filteredAudioSpectrum);
player = audioplayer(y, filteredTimeDomainSignal);
play(player);

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Audio Processing Algorithm Design 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by