I want to generate a sine signal y(t)
with a time dependent frequency f(t)
in Matlab.
I've already tried to realise this using the sine function of Matlab:
h = 0.0001;
npoints = 150/h;
for i = 1:1:npoints
f(i) = 2 - 0.01*i*h;
y(i) = 0.5*sin(2*3.1415*f(i)*i*h)+0.5;
end
where the frequency is decreasing with time and h
is the time step width.
My problem:
The signal y(t)
doesn't look I expected it to look like. There appears a bump in the amplitude at a distinct time (have a look at the plot below).
Does anyone know why this happens and how to generate this sine signal correctly?
0.01*i*h>2
you get a negativef
. – Vahe Tshitoyanf
doesn't get negative here as2 - 0.01*i*h
ist positive for alli <= npoints
. – Peter123