# Designing artificial signals

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.

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:

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;
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)

• 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? – Atul Ingle Dec 12 '16 at 20:41
• I would like to seperate the two ridges further, and have the "tapering off" effect of the upper ridge in the higher frequencies. – Franz Hahn Dec 12 '16 at 20:46
• 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? – Atul Ingle Dec 12 '16 at 22:42
• 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. – Franz Hahn Dec 13 '16 at 7:46

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)


• 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? – Franz Hahn Dec 13 '16 at 9:38
• 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 – Maximilian Matthé Dec 13 '16 at 10:08
• 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? – Franz Hahn Dec 13 '16 at 10:33
• 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. – Maximilian Matthé Dec 13 '16 at 10:36
• You can also try a constant-Q spectrogram. – Atul Ingle Dec 13 '16 at 15:05