clc;

clear all;

close all;

%forming the original signal

t=(0:0.001:0.1);

y=cos(2*pi*50*t);

subplot(3,3,1);

plot(t,y);

grid;

xlabel('time...');

ylabel('amplitude...');

title('original signal f=50 hz');

% sampling at 75 Hz

fs=75;

ts=1/fs;

tx=(0:ts:0.1);

ys=cos(2*pi*50*tx);

subplot(3,3,2);

stem(tx,ys);

grid;

xlabel('time...');

ylabel('amplitude...');

title('75 hz sampling');

subplot(3,3,3);

plot(tx,ys);

grid;

xlabel('time...');

ylabel('amplitude...');

title('75 hz recovery');

% sampling at 100 Hz

fs=100;

ts=1/fs;

tx=(0:ts:0.1);

ys=cos(2*pi*50*tx);

subplot(3,3,4);

stem(tx,ys);

grid;

xlabel('time...');

ylabel('amplitude...');

title('100 hz sampling');

subplot(3,3,5);

plot(tx,ys);

grid;

xlabel('time...');

ylabel('amplitude...');

title('100 hz recovery');

% sampling at 500 Hz

fs=500;

ts=1/fs;

tx=(0:ts:0.1);

ys=cos(2*pi*50*tx);

subplot(3,3,6);

stem(tx, ys);

grid;

xlabel('time...');

ylabel('amplitude...');

title('500 hz sampling');

subplot(3,3,7);

plot(tx,ys);

grid;

xlabel('time...');

ylabel('amplitude...');

title('500 hz recovery');