Variable Amplitude sine wave

조회 수: 11 (최근 30일)
Margarita
Margarita 2014년 7월 2일
편집: Shravankumar P 2014년 7월 2일
Hello, I am trying to learn some more about the function fft, for that I have a code like this
%Time specifications:
Fs = 1000; % samples per second
dt = 1/Fs; % seconds per sample
StopTime = 0.6; % seconds
t = (0:dt:StopTime-dt)'; % seconds
% Sine wave:
Fc = 500; % hertz
x = sin(2*pi*Fc*t);
% Plot the signal versus time:
figure;
plot(t,x);
xlabel('time (in seconds)');
title('Signal versus Time');
zoom xon;
Now I dont understand why, but the output of the plot is a sinusoidal wave that increases in amplitud. why is that? As far as my understanding goes, that should not happen. I know that it has something to do with the Fs value. but what is the relationship exactly. How should I pick a good Fs value to avoid this?
Thank you very much
  댓글 수: 1
Shravankumar P
Shravankumar P 2014년 7월 2일
편집: Shravankumar P 2014년 7월 2일
you need to change the frequncy Fc ; try Fc=10 to 50 ;
or you need to change the Fs, eg: Fs=100000;

댓글을 달려면 로그인하십시오.

채택된 답변

Mischa Kim
Mischa Kim 2014년 7월 2일
편집: Mischa Kim 2014년 7월 2일
Margarita, that's because the dt value is too large. Try
dt = 1e-6;
instead and you should receive a proper sinusoidal signal with a constant amplitude of 1. As far as next steps are concerned, the optimal value of dt depends on your particular application, whatever you need to do.
  댓글 수: 3
Mischa Kim
Mischa Kim 2014년 7월 2일
편집: Mischa Kim 2014년 7월 2일
The frequency of the signal is 500 Hz, the period is therefore 1/500 s which is exactly 2*dt. So you evaluate the sine pretty much dead on at its zero crossings. That's the reason why the signal amplitudes in your plot are tiny (1e-13).
Margarita
Margarita 2014년 7월 2일
Thank you

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Shravankumar P
Shravankumar P 2014년 7월 2일
See this Attached file with Fc=10Hz

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by