Regarding logarithmic chirp signal
21 views (last 30 days)
Show older comments
how to generate logarithmic chirp signal without inbuilt function in matlab
In matlab there is an inbuilt command to generate logarithmic chirp signal using
chirp(t,f0,t1,f1,'method') by simply replacing the method with 'lo', we will get the logarithmic chirp signal. i would like to know the basic mathermatical equation to generate the logarithmic chirp signal.
Thanks in advance.
0 Comments
Answers (1)
Mathieu NOE
on 23 Oct 2020
hi
simple demo below :
% log sweep demo
f1 = 50; % start freq
f2 = 200; % stop freq
Fs = 1e3; % sampling frequency
duration = 30; % s
%%%%%%%%%%%
dt = 1/Fs;
samples = floor(duration*Fs)+1;
t = (0:dt:(samples-1)*dt);
log10_freq = linspace(log10(f1),log10(f2),samples);
freq = 10.^log10_freq;
omega = 2*pi*freq;
angle_increment = omega.*dt;
angle = cumtrapz(angle_increment); % angle is the time integral of omega.
signal = sin(angle);
figure(1);
plot(t,signal)
%%%%%%%%%%%
% spectrogram demo
NFFT = 512; % to have highest frequency resolution , NFFT should be greater than typical max length of files ( 1 second duration at Fs = 16 kHz = 1600 samples);
overlap = 0.75;
w = hamming(NFFT);
fmin = 1;
fmax = Fs/2.56;
[sg,fsg,tsg] = specgram(signal,NFFT,Fs,hamming(NFFT),overlap*NFFT);
% plots sg
figure(2);
imagesc(tsg,fsg,20*log10(abs(sg)));axis('xy');colorbar('vert');
title(['Spectrogram / Fs = ' num2str(Fs) ' Hz / Delta f = ' num2str(fsg(2)-fsg(1)) ' Hz ']);
xlabel('Time (s)');ylabel('Frequency (Hz)');
6 Comments
Mathieu NOE
on 26 Oct 2020
hello
there are many publications on chirp signal formulato be found on the internet
another one : https://en.wikipedia.org/wiki/Chirp
I admit I didn't even look at it before I generate my demo code , as it was quite obvious for me.
Now I also don't understand what you are exactly looking for ? The formula are quite simple to code even if the built in function do it in it own way. As usual, there can be multiple ways to code one function;
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!