This octave/MATLAB script shows the effect of not sampling fast enough.: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 21: | Line 21: | ||
hold off; |
hold off; |
||
</nowiki> |
</nowiki> |
||
[[File:sinewaves_aliasing.png| |
[[File:sinewaves_aliasing.png|800px]] |
Latest revision as of 16:11, 2 November 2016
Two sinewaves fit the same sample points. (There are actually an infinite number that fit. Can you figure out the next higher frequency one?)
% This program demonstrates how a couple of sine waves can be % sampled and have the same sample values. clf; f=1; tmax =5; T = .8; fs = 1/T; %1.25 Hz sample rate t=0:.01:tmax; x = cos(2*pi*f*t); hold on; tk=0:T:tmax; xk = cos(2*pi*f*tk); y = cos(2*pi*(f-fs)*t); plot(t,x,'b',tk,xk,'ro',t,y,'g'); legend('First Signal','Data Samples','Second Signal'); title('Aliasing in the Time Domain'); xlabel('Time (seconds)'); ylabel('Signals'); figure(1); hold off;