1
$\begingroup$

I'm sure there's a simple explanation but I can't discover it. Consider two frequencies, a and b. a is higher than b. I can create a wave with both frequencies. But when I create a wave with frequency decreasing from a to b, the frequency decreases to even slower than frequency b. Consider the following MATLAB code.

timeVals = 0:0.001:1; 
sourceFreq = 8; 
freqPulse = linspace(1,.5,length(timeVals));
sourceActivity1 = cos(2 * pi * (sourceFreq .* freqPulse .* timeVals));

freqPulse = linspace(.5,.5,length(timeVals));
sourceActivity2 = cos(2 * pi * (sourceFreq .* freqPulse .* timeVals)); 

plot(sourceActivity1); hold on; plot(sourceActivity2)

Now, compare the two sourceActivities. The end frequency of sourceActivity1 is even slower than 4. And the frequency at the end of the wave is slower than sourceActivity2. This can be determined using visual inspection alone, or with spectrograms.

$\endgroup$
4
  • $\begingroup$ If I run timeVals = 0:0.001:1; min(8*linspace(1,.5,length(timeVals))) I get exactly 4. I also get exactly 4 when I run timeVals = 0:0.001:1; min(8*linspace(.5,.5,length(timeVals))). Can you clarify what the problem is? $\endgroup$ – MBaz Nov 30 '20 at 23:22
  • $\begingroup$ I agree with the above, and that's in fact what's leading to my confusion. try: plot(sourceActivity1); hold on; plot(sourceActivity2) My confusion is that the ending frequency of sourceActivity1 is not in fact 4, but less than 4. $\endgroup$ – amd1972 Nov 30 '20 at 23:54
  • $\begingroup$ I think I see what you mean. You should edit your question to add this plot. Also: add details on how you are measuring the signals' instantaneous frequency. $\endgroup$ – MBaz Dec 1 '20 at 0:10
  • 1
    $\begingroup$ I think this question and its answer should help. $\endgroup$ – Matt L. Dec 1 '20 at 14:16
0
$\begingroup$

I think the issue is that you aren't ramping down the frequency from A to B, but the phase. The phase needs to be integrated from the last previous value.

Plot the phase argument and you'll see what you did wrong. The phase for source activity 1 should end up parallel but above the phase for source activity 2.

You say that the end frequency is 4 in both cases, but what you really have done is constrict both waveforms to have the same number of cycles. Since source activity 1 starts faster, it must end slower.

$\endgroup$
0
$\begingroup$

As the poster above mentionned, you think you are adjusting the frequency but you're not.

Remember that

$$ \omega(t) = \frac{d\theta(t)}{dt} $$

$$\theta(t) = \int \omega(t)dt$$

where $\omega(t) = 2\pi f(t)$

Therefore you need to construct a vector $\theta(t) $ by integrating the desired frequency vector.

pseudo Matlabish code would look like this

phase = InitFreq + freqSlope*cumsum(ones(1,n))

y = sin(phase)

$\endgroup$

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.