# 1. Generate a sine wave with frequency 100 Hz. a. Sample the signal with a sampling…

clc;clear;
Fs = 1000;
f = 100;
Td = 1/Fs;
t = 0:Td:1/f;
Am = 1;
v = Am*sin(2*pi*100*t);
N = length(v);
subplot(2,2,1)
stem(t,v)
grid on
title ‘with Fs = 1000’
xlabel ‘Time’
ylabel ‘Amplitude’

del_f = (-Fs/2):(Fs/(N-1)):(Fs/2);
X = fftshift(fft(v)/N);
subplot(2,2,2)
plot(del_f,abs(X))
grid on;
xlabel ‘Freq’
ylabel ‘Amplitude’

%%

Fs = 1010;
f = 100;
Td = 1/Fs;
t = 0:Td:1/f;
Am = 1;
v = Am*sin(2*pi*100*t);
N = length(v);
subplot(2,2,3)
stem(t,v)
grid on
title ‘with Fs = 1010’
xlabel ‘Time’
ylabel ‘Amplitude’

del_f = (-Fs/2):(Fs/(N-1)):(Fs/2);
X = fftshift(fft(v)/N);
subplot(2,2,4)
plot(del_f,abs(X))
grid on;
xlabel ‘Freq’
ylabel ‘Amplitude’

%%
Fs = 1000;
f = 100;
Td = 1/Fs;
t = 0:Td:(3/(2*f));
Am = 1;
v = Am*sin(2*pi*100*t);
N = length(v);
figure;
subplot(2,2,1)
stem(t,v)
grid on
title ‘with Fs = 1000’
xlabel ‘Time’
ylabel ‘Amplitude’

del_f = (-Fs/2):(Fs/(N-1)):(Fs/2);
X = fftshift(fft(v)/N);
subplot(2,2,2)
plot(del_f,abs(X))

%%
Fs = 1010;
f = 100;
Td = 1/Fs;
t = 0:Td:(3/(2*f));
Am = 1;
v = Am*sin(2*pi*100*t);
N = length(v);
subplot(2,2,3)
stem(t,v)
grid on
title ‘with Fs = 1010’
xlabel ‘Time’
ylabel ‘Amplitude’

del_f = (-Fs/2):(Fs/(N-1)):(Fs/2);
X = fftshift(fft(v)/N);
subplot(2,2,4)
plot(del_f,abs(X))
grid on;
xlabel ‘Freq’
ylabel ‘Amplitude’

Matlab Result: