I am learning Matlab and now using the function chirp.
freq = 1/11025; duration = 1.5; c = 0:freq:duration;
y = chirp(c,0,150,duration)
The problem is, that it doesn't stop at 1.5. Instead it stops at 1.65 . But I don't know why.
CodePudding user response:
Your interpretation of the chirp() function is not correct. Here is how you can create a fully customizable chirp function via the dsp.Chirp:
hChirp = dsp.Chirp(...
'TargetFrequency', 10, ...
'InitialFrequency', 0,...
'TargetTime', 10, ...
'SweepTime', 10, ...
'SamplesPerFrame', 10000, ...
'SampleRate', 1000);
plot(hChirp()); set(gcf, 'color', 'w'), grid on;
title('Chirp to 10 Hz')
Which gives the following output in this example:
You can refer to the documentation for further detail. This should be a more rigorous way of defining your signal.