2
$\begingroup$

I am translating someone else's code which is written in matlab to mathematica. I need help to design a Butterworth bandpass filter in mathematica to filter a sine wave.

the sine wave is generated using the code:

{freq0, freqs, TrBandw, RCbandw, pulseLength, dt} = {9 10^6, {10 10^6, 20 10^6}, 4, 10^6, 5 10^5, 2.67 10^-6, 1 10^-8};

i = 0;
nfreqs = Length@freqs;
n = Ceiling[pulseLength/dt];

fmin = freqs[[1]] - RCbandw/2;
fmax = freqs[[-1]] + RCbandw/2;

nextend = n*nfreqs;
w = 2 Pi (fmin + Range[0, nextend - 1] (fmax - fmin)/(nextend - 1));

Phi = PadRight[Accumulate[Insert[Table[w[[i]] dt, {i, 2, n*nfreqs}], 0, 1]], IntegerPart[((nfreqs + 1) pulseLength)/dt], 0];

s = Sin[Phi];

Now, the question is how I can define a 3rd order bandpass Butterworth filter with cutoff frequencies of:

cut1 = (freq0 - 0.5 TrBandw)/(1/dt/2)
cut2 = (freq0 + 0.5 TrBandw)/(1/dt/2)

I already tried BandpassFilter[s,{cut1,cut2}]but somehow the amplitudes of the output signal is much smaller than unity.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.