discreting an analog signal at different sampling rate


MATLAB Code:


f=10;
dt=.00005;
t=-.25:dt:.25;
xa=3*cos(2*pi*f*t);
subplot(5,1,1);
plot(t,xa); %plotting analog signal
xlabel('Time');
ylabel('Analog xa');
title('continuous time signal');
Ts=0.001; %sampling time .001
n=0:Ts:1;
xd=3*cos(2*pi*f*n);
k=0:(length(n)-1);
subplot(5,1,2);
stem(k,xd);
Ts=0.003; %sampling time .003
n=0:Ts:1;
xd=3*cos(2*pi*f*n);
k=0:(length(n)-1);
subplot(5,1,3);
stem(k,xd);
Ts=0.004; %sampling time .004
n=0:Ts:1;
xd=3*cos(2*pi*f*n);
k=0:(length(n)-1);
subplot(5,1,4);
stem(k,xd);
Ts=0.05; %sampling time .05
n=0:Ts:1;
xd=3*cos(2*pi*f*n);
k=0:(length(n)-1);
subplot(5,1,5);
stem(k,xd);


Output:

No comments:

Post a Comment