MATLAB: Ideal low-pass filter transfer function

fftfrequency domainlow passlowpassrectangular signalrectangularsignaltransfer function

i have a signal in frequency domain (that i made fft and fftshift before) and i need to multiply it by a transfer function of an ideal low-pass filter with bandwith around 25Hz. i can't use the lowpass function and i need to only use the simplest basic functions.
so since it is an ideal low-pass filter, i was thinking multiply my signal with a rectangular signal in frequency domain. but my question is i don't know how to write a rectangular signal transfer function in frequency domain. Any recommendations? Thank you.

Best Answer

The ‘ideal’ filter is symmetrical about the origin in the frequency domain (after doing the fftshift call), so will be 1 from -25 Hz to +25 Hz, and zero elsewhere. Define it as such, and then do the multiplication with the signal in the frequency domain. Then use ifftshift on the filtered signal, then ifft to return it to the time domain.
Be sure to scale the result correctly, since filtering removes much of the energy in the original signal.