In: Electrical Engineering
Write the matlab command to sample the following signals at nyquist frequency
1.x(t)=3cos(2*pi(400)t +0.3*pi)
2.x(t)=cos^2(300*pi*t)
1.
%Sampling Theorem
clear all;
close all;
clc;
fs1=1000; % fs1>2*fmax
t=0:0.1:2*pi;
t1=0:99
x=3*cos(2*pi*440*t+0.3*pi);
subplot(2,1,1);
plot(t,x);
xlabel('Time-->t');
ylabel('Amplitude');
title('Continuous cosine wave');
xt=3*cos(2*pi*440*t1/fs1+0.3*pi);
subplot(2,1,2);
stem(t1,xt);
xlabel('Time');
ylabel('Amplitude');
title('Sampled singal at Nyquist rate 1KHz');
output:
2.
clear all;
close all;
clc;
fs1=1500; % sampling frequency at nyquist rate
t=0:0.1:2*pi;
x=(cos(300*pi*t)).^2;
subplot(2,1,1);
plot(t,x);
xlabel('Time-->t');
ylabel('Amplitude');
title('Continuous cosine wave');
xt=(cos(300*pi*t/fs1)).^2;
subplot(2,1,2);
stem(t,xt);
xlabel('Time');
ylabel('Amplitude');
title('Sampled singal at Nyquist rate');
output: