0
$\begingroup$

I have been asked to prove the following;

Show that a sinusoid of amplitude 10V and frequency 2kHz sampled at %fs = 10kHz is an alias of a 500Hz sampled signal.

I have develped the code for the 500hz sample

V= 10;
Fs = 10000; % Sampling frequency = 10 kHz
t = [1:1:10]/Fs; % Constructs a time array t with 10 samples
y= E*sin(1000*pi*t); creates array y1 of 10 samples of 500Hz
plot(t,y)

for the 1khz sample I have altered the code to change the frequency.

V= 10;
Fs = 10000; % Sampling frequency = 10 kHz
t = [1:1:10]/Fs; % Constructs a time array t with 10 samples
y = E*sin(2000*pi*t); % creates array y1 of 10 samples of 1kHz
plot(t,y)

When plotted they are coming out as the same as I have hard coded the time array for only 10 samples. What way is it that I can setup a time array that will be able to demonstrate the signal are ailas?

I have made a search and am unable to find a similar answer to this question.

$\endgroup$
2
  • 2
    $\begingroup$ You mention both 500 Hz and 500 kHz, and it is not clear which one corresponds to the original problem statement. Please edit your question to clarify this. Also consider adding the homework tag if this is so. $\endgroup$
    – Juancho
    Feb 14, 2023 at 13:44
  • $\begingroup$ Its 500hz.. would you have any reasonable solution to the question? $\endgroup$
    – Tam
    Feb 14, 2023 at 19:30

1 Answer 1

0
$\begingroup$

When plotted they are coming out as the same as I have hard coded the time array for only 10 samples.

No and no. They are not the same, and it has nothing to do with whether you hard code the time array or not. Your text mentions 500Hz and 2kHz but your code covers 500Hz and 1kHz. No matter, none of these would produce any aliasing since the Nyquist frequency is 5 kHz. Please triple check your actual assignment and make sure you have the details correct.

What way is it that I can setup a time array that will be able to demonstrate the signal are ailas?

That's mainly a programming question. Here is an example of "cleaner code". Use variables, don't duplicate code, use good comments, label all your graphs properly, etc. There is one variable that controls the length of the time

%% create two sine waves and plot them

% parameters
V = 10; % amplitude
fs = 10000; % sample rate in Hz
freq1 = 500;
freq2 = 2000;

% build the sine waves
numSamples = 128;
timeAxis = (0:numSamples-1)'/fs;
x1 = V*sin(2*pi*timeAxis*freq1);
x2 = V*sin(2*pi*timeAxis*freq2);

%% plot them, label everything
clf;
plot(timeAxis,[x1 x2]);
grid('on');
ylabel('Amplitude in V');
xlabel('Time in seconds');
legend('500 Hz', '2000 Hz');
$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.