As there is no ChirpSignal
function in Mathematica, can anyone tell me how to write a custom function to generate a sinusoid with a frequency that changes continuously from frequency f1
to f2
over a certain time of t
?
This is what I done to generate the chirp:
{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];
At the end, I need to filter the chirp with a Butterworth (or any other filter) to remove frequencies that do not fit in the span of [cutoff1, cutoff2]
cut1 = (freq0 - 0.5 TrBandw)/(1/dt/2)
cut2 = (freq0 + 0.5 TrBandw)/(1/dt/2)
cut1 = 0.14 Hz
cut2 = 0.22 Hz
The final result looks something like this in matlab
Most part of my problem lies in the filtering. So, instead of my code for the chirp, I can use the simpler approach suggested. Still, it would be great to have help with the filtering part, too.
Comments
Post a Comment