You are on page 1of 7

2B) TIME SHIFTING PROPERTY

clc; x=[-
50:1:50];
y=sign(x)-sign(x-10); z=sign(x)-
sign(x-20); yft=real(fftshift(fft(y)));
zft=real(fftshift(fft(z)));
z2=real(yft.*real(exp(-1i*2*pi./x)));
subplot(2,1,1);

plot(x,zft);
title('Original Signal');
xlabel('x');
ylabel('fft');
subplot(2,1,2);
plot(x,z2);
title('Tile Shifted signal');
xlabel('x');
2C) FREQUENCY SHIFTING

clc; x=[-
50:1:50];
y=sign(x)-sign(x-10);
z=y.*exp(-1i*2*pi./10.*6);
yft=real(fftshift(fft(y)));
zft=real(fftshift(fft(z)));
subplot(2,1,1); plot(x,yft);

title('Original Signal');
subplot(2,1,2);
plot(x,zft);
title('Frequency Shifted Signal');
3/4/5A) TO PLOT THE PROBABILITY DENSITY FUNCTION OF A SET OF RANDOM
NUMBERS
clc;
n=rand(1,700);
hist(n);
title('PDF');
xlabel('random values,x');
ylabel('P(x)');
3/4/5B) COMPUTE THE MEAN AND VARIANCE OF UNIFORMLY AND NORMALLY
DISTRIBUTED NUMBERS

m1 = 0.4811
v1 = 0.0794
m2 = -0.0105
v2 = 0.9683
3/4/5C) VERIFY THE CENTRAL LIMIT THEOREM

clc;
clear all;
close all;
a=randn(1000,1);
b=randn(1000,1);
c=randn(1000,1);
sum=a+b+c;
nbin=50
hist(sum,nbin);
title('Probability Density Function');
xlabel('Normally Distributed Numbers');
ylabel('P(x)');
3/4/5D) GENERATE EXPONENTIALLY DISTRIBUTED RANDOM NUMBERS FROM
UNIFORMLY DISTRIBUTED RANDOM NUMBERS

clc;
x=rand(1,1000);
y=-log(x);
subplot(2,1,1);
nbin=50;
hist(x,nbin);
title('PDF-uniformly distributed number');
subplot(2,1,2);
hist(y,nbin);
title('PDF-exponentially distributed number');
3/4/5E) GENERATE RAYLEIGH DISTRIBUTED RANDOM NUMBERS FROM
GAUSSIAN DISTRIBUTED RANDOM NUMBERS
clc;
x=randn(1,1000);
y=randn(1,1000);
z=sqrt(x.^2+y.^2);
nbin=50;
subplot(3,1,1);
hist(x,nbin);
title('Normal PDF');
subplot(3,1,2);
hist(y,nbin);
title('Gaussian PDF');
subplot(3,1,3);
hist(z,nbin);
title('Rayleigh PDF');

You might also like