Plot sine wave whose frequency changes with time

조회 수: 1 (최근 30일)
pk
pk 2012년 2월 22일
Hello.I want to plot a sine wave whose frequency changes with time. The equation is y=sin(2*pi*(50+g)*t) where g=sin(10*pi*t) My problem is ,when I plot the function y from t=0 to 2s, There are "zones" where it does not oscillate.So can some one point out where my mistake is ,thank you.I have been struggled at this point for days. Here is my code:
fs=1000 %Sampling frequency
Ts=1/fs %Sampling period
L=2000 %Sampling length (2000 points)
n=(0:L-1)*Ts %Samples
for count_n=1:length(n)
g(count_n)=sin(10*pi*n(count_n))
y(count_n)=sin(2*pi*(50+g(count_n))*n(count_n))
F(count_n)=50+g(count_n)
end

답변 (1개)

Grzegorz Knor
Grzegorz Knor 2012년 2월 22일
t = linspace(0,2,2000);
plot(t,sin(2*pi*(50+sin(10*pi*t)).*t))

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by