what does the notation ( ' ) in the time sample t = (0:dt:0.002-dt) ' mean ??and thanks in advance
2 views (last 30 days)
Show older comments
abdalrahman elhaw
on 17 Dec 2013
Commented: abdalrahman elhaw
on 18 Dec 2013
Fs = 800e3;
dt = 1/Fs;
t = (0:dt:0.002-dt)';
Fm = 5000;
y = cos(2*pi*Fm*t);
figure;
plot(t,y);
0 Comments
Accepted Answer
Wayne King
on 17 Dec 2013
Edited: Wayne King
on 17 Dec 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.
More Answers (1)
Wayne King
on 17 Dec 2013
Edited: Wayne King
on 17 Dec 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 Comments
Wayne King
on 17 Dec 2013
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
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!