Audio Chirp From Point Backwards
Show older comments
Hi,
I would like to be able to create a sine wave starting at a given point (for example at 2 seconds) and from this point backwards to the start a chirp which will be in phase with the sine wave. It does not matter where the chirp is ending. If this isn't directly possible maybe there is a way to create it forwards and inverse the whole construct later. Thanks!

Accepted Answer
More Answers (1)
Voss
on 27 Dec 2021
0 votes
4 Comments
Lars Wendler
on 27 Dec 2021
Voss
on 27 Dec 2021
Here's an example from the documentation that creates a chirp with frequency 0 at time 0 and frequency 250 Hz at time 1 second.
t = 0:1/1e3:2;
y = chirp(t,0,1,250);
If you want, say frequency 0 at time 2 seconds and frequency 250 Hz at time 0, you can do this instead:
t = 0:1/1e3:2;
y = chirp(t,250,2,0);
Lars Wendler
on 27 Dec 2021
Voss
on 27 Dec 2021
I see. So you can use chirp like this:
t = 0:1/1e4:2;
y = chirp(t,340,2,540);
It looks like chirp will always give a signal whose amplitude is 1 at the beginning and end (implicit in the definition of a "swept-frequency cosine signal" perhaps), i.e., an integer number of periods is used. Therefore, the phase-matching is easy: you can create another cosine signal of frequency 540 Hz that lasts another 2 seconds, say, and concatenate it to the end of y (actually dropping off the last sample of y since it'll be in the new signal). The two signals match phases at t=2 because I use t starting at 0 to calculate the second signal.
y = [y(1:end-1) cos(2*pi*540*t)];
and then the time vector for the combined signal would be:
t = [t(1:end-1) t+2];
Categories
Find more on Waveform Generation 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!