简体   繁体   中英

Matlab chirp duration is longer than it should be

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.

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: 啁啾至 10 Hz

You can refer to the documentation for further detail. This should be a more rigorous way of defining your signal.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM