0
\$\begingroup\$

I've been getting into sampling recently, and seem to have a problem with how to actually "plot" an alias frequency, and was hoping some of you might be able to help.

I have a sin-wave with an amplitude of 1 and a frequency of 3Hz. This means that when the "wave" have repeated itself 3 times you reach 1 second in time.

But now I got a sampling rate of 5Hz (for practicing aliasing), and in theory this would simply be sampleF - F => 5 - 3 = 2Hz. However, I'm not sure how I plot this 2Hz on my 3Hz signal? How should I "think" when plotting?

My plotting of 2Hz(Fsample - F = 2Hz) on a 3Hz signal:

enter image description here

\$\endgroup\$
10
  • \$\begingroup\$ The point of aliasing is that the 3 Hz signal will appear as a 2 Hz signal. So you plot it on your plot exactly as you would a 2 Hz signal. \$\endgroup\$
    – user57037
    Commented Aug 20, 2020 at 5:21
  • \$\begingroup\$ is it correct that whenever you get a full number such as 2,3,4 etc, the new line will always just be a flat line? Because by the looks of it, my 2Hz signal should just be "flat". \$\endgroup\$
    – user255498
    Commented Aug 20, 2020 at 5:28
  • \$\begingroup\$ Erik, I am not really sure what you mean. Maybe a picture or graph or something would help? If you do add a graph, the preferred way is to edit the question and add it there. If possible (there may be some restrictions on privilege for new users... not sure). \$\endgroup\$
    – user57037
    Commented Aug 20, 2020 at 5:42
  • \$\begingroup\$ Updated my answer with an image. What am I doing wrong? (if it's wrong) \$\endgroup\$
    – user255498
    Commented Aug 20, 2020 at 5:57
  • 1
    \$\begingroup\$ Hmmm. So the way to see it is to make a graph that has all of the following: 2 Hz signal, 3 Hz signal, and vertical lines at all sample points to show where signal will be sampled. The 2 Hz and 3 Hz signals will cross at all sample points. \$\endgroup\$
    – user57037
    Commented Aug 20, 2020 at 6:08

1 Answer 1

1
\$\begingroup\$

As mentioned in the comments to the question, the sampled points will be those points where 2Hz and 3Hz sinusoids will cross each other.

Wikipedia article for aliasing has the figure you seek; but not for 3Hz and 2 Hz.

Link to figure The even have code for producing the figure it seems.

Another figure

Here is one I made with Octave. Initially it surprised me that the sampled points were NOT the points where the graphs were crossing each other. Then I realised that for the 2,3,5 combination, the negative frequency is getting aliased. So below you will find two sets of figures where 3Hz and 2Hz are plotted together and another set where 2Hz and negated 3Hz sinusoids are plotted together.

aliasing figure

Octave code for producing this figure.

clear;

% a time vector with much much higher sampling frequency
% to represent the original continuous time signal.
time = [0 : 0.02 : 2]';

s3 = (-1) * sin(3*2*pi*time);
s2 = sin(2*2*pi*time);

% produces logical one at time period corresponding to 5Hz frequency
sample = abs(rem(time, 1/5))< 100*eps;

subplot(2,1,1);
% continuous time signal
plot(time, [s2,s3]);
hold on;

% samples
plot(time(sample), s2(sample), 'x', time(sample), s3(sample), '+');

legend('2Hz', '3Hz', '2Hz sampled', '3Hz sampled');
xlabel('time (s)');

subplot(2,1,2);
stem(time, sample);
legend('sampler');
xlabel('time (s)');
ylim([-1 2]);
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.