I am trying to run a code that results in AM. But in the frequency spectrum, I get the spectrum at a carrier frequency 6 times the original. What am i doing wrong?

1 回表示 (過去 30 日間)
Jenny
Jenny 2013 年 10 月 17 日
コメント済み: David 2013 年 10 月 20 日
fs=input('Input the sampling frequency : ');
fc=input('Input the carrier frequency : ');
fm=input('Input the message frequency : ');
Am=input('Input the message amplitude : ');
Ac=input('Input the carrier amplitude : ');
dt=1/fs;
t=[-3:dt:3];
m=Am*cos(2*pi*fm*t);
f=1./t;
M=ammod(m,fc,fs,0,Ac);
subplot(2,1,1)
plot(abs(fft(M)));
hold
subplot(2,1,2)
plot(t,M);
  2 件のコメント
Navan Ruthramoorthy
Navan Ruthramoorthy 2013 年 10 月 18 日
What are the values you used when you tried? Can you post code with all the values for fs, fc etc plugged in instead of using input?
Jenny
Jenny 2013 年 10 月 20 日
Ok. Here it is -
fs=10000;
fc=1000;
fm=10;
Am=1;
Ac=10;
dt=1/fs;
t=[-3:dt:3];
m=Am*cos(2*pi*fm*t);
f=1./t;
M=ammod(m,fc,fs,0,Ac);
subplot(2,1,1)
plot(abs(fft(M)));
hold
subplot(2,1,2)
plot(t,M);

サインインしてコメントする。

回答 (1 件)

David
David 2013 年 10 月 20 日
編集済み: David 2013 年 10 月 20 日
Are you remembering to divide by 2*pi in your frequency plot?? w = 2*pi*f and 2*pi~6.
If this isn't the problem then it may be the number of FFT points you are using. NFFTPts = (Fs*(max(T) - min(T)))/2.
  2 件のコメント
Jenny
Jenny 2013 年 10 月 20 日
編集済み: Jenny 2013 年 10 月 20 日
I did forget to multiply 2*pi*f. But while doing so, i get 6283.18 rad/s. Whereas, what i get in the frequency spectrum is ~6000, like you said. But this difference in values, is it acceptable?(Im quite new to the subject of communication systems and the use of matlab)
When i applied 'NFFTPts = (Fs*(max(T) - min(T)))/2', Im getting the frequency as ~3000 rad/s.
David
David 2013 年 10 月 20 日
編集済み: David 2013 年 10 月 20 日
Okay, since I do not know exactly how you are using the FFT function, a division of 2 may or may not be valid.
As for the slight differences you are getting in frequency, that might be due to the frequency resolution of your plot. Frequency resolution is given by the following equation:
df = 1/T = Fs/N
where T is total acquisition time, N is the number of samples, and Fs is the sampliing frequency. However, in your case, this would be df = 1/6 Hz, which is much smaller than the error you are getting. I'm not sure why you are getting these mixed results...
Note: The frequency resolution improves as the observation time T increases.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangePulsed Waveforms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by