Monday 18 July 2016

matlab - Generating a Sine Signal (for example a voltage sine wave) with changing frequency and changing sample rate (time)?


enter image description here i have a measured signal (e.g. voltage sine wave) and i would like to generate a sine wave which matches this meausred signal (with the generated sine wave i remove the harmonics from my measured signal), just like a PLL block in simulink.


for that i have to do the 2 steps:


1- Calculate the frequency of the measured signal from detecting the Zerocrossing.


2- calcualte the sine function using sin(2*pi*f(t)*t).


I have the following problem.



1- calcuating the frequency by counting the samples between two zerocrossing would results in getting the frequency at one point so my calcualted fequency does not match my sampled measured signal.


2- even when interpolating or using the repmat function i am able to get the f(t) to be the same length as the time (t) vector yet my sine wave is not correctly calcualted. i know that:


I am adding the zerocrossing times on my time vector which makes the last one inconsistance which mean the sampling rate is changing also.


so how to genereate a sine wave which changing frequency and changing sampling rate of the time signal?


Best Reagrds




No comments:

Post a Comment

readings - Appending 内 to a company name is read ない or うち?

For example, if I say マイクロソフト内のパートナーシップは強いです, is the 内 here read as うち or ない? Answer 「内」 in the form: 「Proper Noun + 内」 is always read 「ない...