what does the notation ( ' ) in the time sample t = (0:dt:0.002-dt) ' mean ??and thanks in advance

 Réponse acceptée

Wayne King
Wayne King le 17 Déc 2013
Modifié(e) : Wayne King le 17 Déc 2013
It is just making a column vector out of your time instants so that the resulting sine wave is also a column vector.
The above example would work equally well without the ', the only difference being that t and y would be row vectors
Fs = 800e3;
dt = 1/Fs;
t = (0:dt:0.002-dt);
Fm = 5000;
y = cos(2*pi*Fm*t);
figure;
plot(t,y);
However, further processing might be made easier by having a column vector.

1 commentaire

ok,but why the spectrum is not correct if i wrote time sample as t = (0:dt:0.002-dt);

Connectez-vous pour commenter.

Plus de réponses (1)

Wayne King
Wayne King le 17 Déc 2013
Modifié(e) : Wayne King le 17 Déc 2013
What makes you say the spectrum is not correct?
Fs = 800e3;
dt = 1/Fs;
t = (0:dt:0.002-dt);
Fm = 5000;
y = cos(2*pi*Fm*t);
ydft = fft(y);
ydft = ydft(1:length(y)/2+1);
df = Fs/length(y);
freqvec = 0:df:Fs/2;
plot(freqvec,abs(ydft))
It is exactly what I would expect.

5 commentaires

sorry , i mean this code how Fequency sample is written and why row vector is different from colum vector as they both generate the same values
Fs = 1000;
Ts = 1/Fs;
t =( 0:Ts:1-Ts)';
N = size(t,1);
B =input('modulation index=');
Fm =input('signal frequency=');
Fc =input('carrier frequency=');
x = cos(2*pi*Fc*t+(B*sin(2*pi*Fm*t)));
figure;
plot(t,x);
xlabel('Time');
ylabel('Amplitude');
title('Modulated Signal');
X = fftshift(fft(x));
dF = Fs/N;
f = -Fs/2:dF:Fs/2-dF;
figure;
plot(f,abs(X));
xlabel('Frequency (in kHZ)');
title('spectrum of FM');
Well for one thing I see in the above you have the sampling frequency set to 1000 Hz. I don't know what values you eventually provide for all your input() statements, but I see from your xlabel() in kHz that you are way undersampling the signal -- you are going to alias the output. You can't have a carrier frequency in the kHz range when the sampling frequency is only 1 kHz.
thanks for replying, but waht about the frequency vector ?i do not understand why it is in this form f = -Fs/2:dF:Fs/2-dF;
because you have called fftshift which centers the DC component in the middle so the spectrum runs from -Fs/2 to Fs/2 in increments of df
OK,Why not writing it like Fs/2:dF:Fs/2;

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by