1
$\begingroup$

I'm trying to design a sample signal that has two "components". I want the signal to look like the upper left figure, with the two components shown on the right. The time frequency spectrum is shown in the bottom left.

signal

I'm using MATLAB to generate this signal, as I am running MATLAB code that uses these signals. I have been trying my heart out with a combination of chirps, sincs and cos functions, but I just can't for the life of me reproduce this sort of a spectrogram. What I have produced looks like this:

my signal

It's quite close I feel, but there is something missing. Can someone point me to a way to approach this?

EDIT:

This is the code I use:

fs = 5000;
x0 = 1;
t = -x0:1/fs:x0;
yi = cos(t).*sinc(t).*chirp(t,150,0.2,250,'quadratic'); 
yj = cos(t).*sinc(t).*chirp(t,50,0.4,150,'quadratic'); 
subplot(2,2,1)
plot(t,yi+yj)
subplot(2,2,2)
plot(t,yj)
subplot(2,2,3)
spectrogram(yi+yj,512,511,256,fs,'yaxis')
subplot(2,2,4)
plot(t,yi)
$\endgroup$
  • $\begingroup$ What do you mean by "missing." specifically? Is it that the two U-shaped "ridges" in your spectrogram don't look as sharp? Or that your signal envelope decays to zero near the edges? $\endgroup$ – Atul Ingle Dec 12 '16 at 20:41
  • $\begingroup$ I would like to seperate the two ridges further, and have the "tapering off" effect of the upper ridge in the higher frequencies. $\endgroup$ – Franz Hahn Dec 12 '16 at 20:46
  • $\begingroup$ Looks like the upper ridge is not a quadratic chirp. It's very hard to see in the first image, but is it shaped more like a cosine? $\endgroup$ – Atul Ingle Dec 12 '16 at 22:42
  • $\begingroup$ It is a quadratic chirp though, if you look at the edit I made. My understanding of signals is quite unpolished, so I may be doing something blatantly wrong. $\endgroup$ – Franz Hahn Dec 13 '16 at 7:46
0
$\begingroup$

In the code below I have manually created chirps where the frequency does not increase linearly, but behaves in a cosine-shape, as suggested by Atul Ingle . This waveform resembles the shape of the lines in the spectrogram nicely.

fs = 5000;
x0 = 1;
t = -x0:1/fs:x0;
yi = cos(t).*sinc(t/1.5).*cos(2*pi*500*(1.8-cos(2.2*t)).*t); 
yj = cos(t).*sinc(t/1.5).*cos(2*pi*500*(0.85-0.5*cos(2.3*t)).*t); 
subplot(2,2,1)
plot(t,yi+yj)
subplot(2,2,2)
plot(t,yj)
subplot(2,2,3)
spectrogram(yi+yj,512,511,256,fs,'yaxis')
subplot(2,2,4)
plot(t,yi)

Program output

$\endgroup$
  • $\begingroup$ Thank you very much, this is very helpful. Can I read off the frequencies of the chirp at t0 and some t1 similarly to when I use the chirp function? I mean I can look at the spectrogram and can see that the lower one goes from ~200 to ~1000 in a matter of 1 second, and the upper goes from ~500 to ~2000 in the same timeframe. But can I intuitively understand your manual chirps in a way that let's me adjust them to the frequencies I'd like? $\endgroup$ – Franz Hahn Dec 13 '16 at 9:38
  • $\begingroup$ The expressions (500*(1.8-cos(2.2*t)) describes the instantaneuos frequency at time t. So, for t=0, the frequency would be 500*(1.8-1)=400, up to 500*(1.8-cos(2.2))=1940 $\endgroup$ – Maximilian Matthé Dec 13 '16 at 10:08
  • $\begingroup$ Thank you. One further question, if I may: Does the signal shown in the original post seem real? Whenever I do a spectrogram on lower frequency signals (as shown in the original post) the spectrograms don't show clear ridges. For example here, the chirp goes from 0.5Hz to 10Hz, but the y-axis of the spectrogram still goes into the kHz range. Is there some way I can adjust the resolution of the spectrogram to still show the frequency spectrum of these lower frequency chirps? $\endgroup$ – Franz Hahn Dec 13 '16 at 10:33
  • $\begingroup$ instead of the spectrogram function, you might consider wavelet transforms, which give you higher resolution in lower frequencies, but less time-resolution for these areas. in contrast, the spectrogramm is the STFT squared, having similar resolution among all times and frequencies. $\endgroup$ – Maximilian Matthé Dec 13 '16 at 10:36
  • $\begingroup$ You can also try a constant-Q spectrogram. $\endgroup$ – Atul Ingle Dec 13 '16 at 15:05

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.