jkchan@rodan.acs.syr.edu (10/20/90)
I am programming a frequency varying sin function like: y = sin ( 2 PI (f+df)(t+dt)/sf) where PI=3.14159 f=initial frequency df=delta change of frequency t=time df=delta change of time sf=sampling frequency = # of sample points/sec The problem is that the final waveform of y is not varying as what I like. I used 1000Hz and 2000Hz for initial and final f respectively but it actually gave 3000Hz at the end, or something like that. Are there anyone who have met this situation and fixed it before? I am sure it is due to the discrete computation of the function because this problem of frequency modulation does not happen in analog world. Any pointer is much appreciated. Please email to the above address. Thanks in advance. Jim -- Jim Chan Hearing Lab Communication Sciences and Disorders School of Special Education
jkchan@rodan.acs.syr.edu (10/26/90)
A week ago I asked for help for the discrete sin function programming probelm I met. Thanks for the responses. All of you are very helpful and my problem has been solved. My original problem was frequency change in a sinusodal sine wave. For those who knows calculus, that is easy to understand: In general: y = M sin x with w = dx/dt = 2 PI f Now, for a constant frequency sine wave, f = f0, dx = 2 PI f0 dt which integrates to x = 2 PI f0 t + c (if we set x=c when t=0) Hence, y = M sin (2 PI f0 t + c) which is the well-known simple (constant frequency) sinusodal equation. But, for a linear frequency changing waveform, f = f0 + k t, where k is a proportionality constant, we have dx = 2 PI (f0 + k t) dt which integrates to x = 2 PI f0 t + 2 PI k t**2 / 2 + c where c is the integration constant. Then y = M sin (2 PI f0 t + 2 PI k t**2 / 2 + c) which is the correct model for a linear frequency changing sinusodal waveform. My mistake was that I just change the frequency of the constant frequency sinusodal equation from y = M sin (2 PI f0 t + c) to y = M sin (2 PI (f0 + k t) t + c) which expands to y = M sin (2 PI f0 t + 2 PI k t**2 + c) and is incorrect. You can see the 1/2 factor is missing in the incorrect equation. Very interesting! Thanks a million to all of you. I appreciate it. Jim -- Jim Chan Hearing Lab Communication Sciences and Disorders School of Special Education