Vous êtes sur la page 1sur 19

Experiment No.

1
AIM: Introduction to MatLab(Matrix Laboratory). a. Matrix Computation. b. To plot sine wave of frequency 200 Hz. c. To plot a pulse of width 10. d. Plot the spectrum (Amplitude and phase) of the pulse generated in (c). MATLAB COMMANDS TO BE USED: clear all, plot, bar, ones, zeros, sine, fft, fftshift. a. Matrix Computation.
clear all close all A = [1 2 3; 4 5 6; 7 8 9] B = [2 4 9; 3 8 2; 6 5 1] C=A+B D=A-B E=A*B F = A .* B G = A' H = inv(B) OUTPUT: A= 1 2 3 4 5 6 7 8 9 B= 2 4 9 3 8 2 6 5 1 C= 3 6 12 7 13 8 13 13 10 D= -1 -2 -6 1 -3 4 1 3 8 E= 26 35 16 59 86 52 92 137 88 F= 2 8 27 12 40 12 42 40 9 G= 1 4 7 2 5 8 3 6 9

H= 0.0075 -0.1547 0.2415 -0.0340 0.1962 -0.0868 0.1245 -0.0528 -0.0151 b. Plot sine wave of frequency 200 Hz. clear all; close all; f = 200; % frequency of sine wave in Hz f_rps = 2*pi*f; % frequency in radian per second t = 0:0.0001:0.005; y = sin(f_rps * t); plot(t,y); title('Sine wave'); xlabel('t(time)'); ylabel('sin(t)');

c. Plot a pulse of width 10.


clear all; close all; a=ones(1,10); b=zeros(1,10); c=[b a b a b a b a]; plot(c); title('Pulse(Width 10)'); xlabel('time'); ylabel('y');

d. Amplitude and phase spectrum


clear all; close all; a=ones(1,10); b=zeros(1,10); c=[b a]; subplot(4,1,1); plot(c); ylabel('Original Signal'); d = fft(c); subplot(4,1,2); plot(fftshift(d)); ylabel('Fourier Transform'); e = abs(d); subplot(4,1,3); plot(fftshift(e)); ylabel('Amplitue Spectrum'); f = phase(d); subplot(4,1,4); plot(fftshift(f)); ylabel('Phase Spectrum');

Experiment no. 2
AIM: To observe the effects of the following distortions introduced by the channel due to its non-ideal characteristics. 1) Amplitude Distortion(Due to non-ideal amplitude spectrum of the channel) 2) Phase Distortion(Due to non-ideal phase spectrum of the channel) 3) Distortion caused by band limited channel (ISI). Amplitude Distortion
a= ones(1,8); b=zeros(1,8); c=[a b a]; subplot(1,4,1); plot(c); ylabel('original signal'); amp=abs(fft(c)); p= phase(fft(c)); subplot(1,4,2); plot(amp); xlabel('amplitude spectrum of undistorted signal'); r = rand(size(amp)); amp = amp .*r; subplot(1,4,3); plot(amp); ylabel('amplitude spectrum of distorted signal'); d = ifft(amp); subplot(1,4,4); plot(d); xlabel('distorted signal');

Phase Distortion
a= ones(1,8); b=zeros(1,8); c=[b a b a]; subplot(1,3,1); plot(c); xlabel('original signal'); amp=abs(fft(c)); p= phase(fft(c)); subplot(1,3,2); plot(p); ylabel('phase spectrum of undistorted signal'); r=rand(size(p)); p=p.*r; n1=amp.*sin(p); n2=amp.*cos(p); d= ifft(complex(n2,n1)); f=phase(d); subplot(1,3,3); plot(d); xlabel('distorted signal');

Distortion caused by band limited channel (ISI)


a=zeros(1,10); b=ones(1,10); x=[a b a b a b a b a b a]; subplot(3,1,1); plot(x); fftx=fft(x,1024); temp=fftshift(fftx); temp(1:400)=0; temp(600:1000)=0; subplot(3,1,2); plot(abs(temp)); subplot(3,1,3); plot(abs(ifft(temp))),axis([0 60 0 1.5]) ;

Experiment no. 3
AIM: To Verify (a) Convolution Property
t=0:1:100; x=[t>=10&t<=20]; subplot(2,2,1),plot(x),title('Pulse 1') y=[t>=10&t<=25]; subplot(2,2,2),plot(y),title('Pulse 2') s=abs(ifft(fft(x).*fft(y))); subplot(2,2,3),plot(s),title('By Multiplication') z=conv(x,y)

subplot(2,2,4),plot(z),title('Convolution')

(b)

Time Shifting Property

clear all; close all; a=ones(1,128) b=zeros(1,128) pulse=[b a b a b]; subplot(2,1,1),plot(pulse),title('pulse'); fftpulse=fftshift(fft(pulse,256)); for n=1:1:256 c(n)=fftpulse(n).*exp((128*j*2*pi*n)/256); end d=abs(ifft(c));

subplot(2,1,2),plot(d),title('time shifting ');

(c)

Frequency Shifting

clear all; close all; a=ones(1,90) b=zeros(1,90) pulse=[b a b]; subplot(2,2,1),plot(pulse),title('pulse'); fftpulse=fftshift(fft(pulse,256)); subplot(2,2,2),plot(abs(fftpulse)),title('fft'); for n=1:1:128 c(n)=pulse(n).*exp((90*j*2*pi*n)/256);

end d=(fftshift(fft(c,256))) subplot(2,2,3),plot(abs(d)),title('spectrum');

Experiment No. 4
AIM: 1. To generate an amplitude modulated wave using amod command and demodulate it using ademod command. 2. a) To generate an amplitude modulated wave (m = 1/2 ). b) Plot the spectrum of the amplitude modulated wave. Amplitude modulation.
Fs=150; t=[0:.1:1.5*Fs+1]'/Fs; Fc=10; x=sin(2*pi*t);

y=amod(x,Fc,Fs,'amdsb-tc',3); plot(t,y); title( Amplitude Modulated Wave ( m = 1/2 ) ); xlabel( Time ); ylabel( Amplitude );

Amplitude Demodulation.
Fs=150; t=[0:.1:1.5*Fs+1]'/Fs; Fc=10; x=sin(2*pi*t); y=amod(x,Fc,Fs,'amdsb-tc',3); z=ademod(y,Fc,Fs,'amdsb-tc'); plot(t,z); title('Demodulated Wave ( m = 1/2)'); xlabel('Time'); ylabel('Amplitude');

Spectrum of amplitude modulated wave. Fs=150; t=[0:.1:1.5*Fs+1]'/Fs; Fc=10; x=sin(2*pi*t); y=amod(x,Fc,Fs,'amdsb-tc',3); subplot(2,1,1); plot(t,y); title('Modulated Wave ( m = 1/2)'); xlabel('Time'); ylabel('Amplitude');

subplot(2, 1, 2); plot(t,fftshift(fft(y))); title('Modulated Wave ( m = 1/2)'); xlabel( Frequency'); ylabel('Amplitude');

Experiment No. 5
AIM: To generate DSBSC wave using amod command and demodulate it using demod command. clear all; t=0:.001:1; Fs=100; Fc=10; x=sin(2*pi*t); y=amod(x,Fc,Fs,'amdsb-sc'); subplot(2,1,1); plot(t,y); title('A DSBSC Amplitude Modulated wave'); xlabel('Time');

ylabel('Amplitude'); z = ademod(y,Fc,Fs,'amdsb-sc'); subplot(2,1,2); plot(t,z); title('A DSBSC Amplitude Demodulated wave'); xlabel('Time'); ylabel('Amplitude');

Experiment No. 6
AIM: To generate a frequency modulated wave using amod command and demodulate it using ademod command. Plot the spectrum of the frequency modulated wave. clear all; t=0:.001:1; Fs=100; Fc=10; x=sin(2*pi*t);

y=amod(x,Fc,Fs,'fm'); subplot(3,1,1); plot(t,y); title('A Frequency Modulated wave'); xlabel('Time'); ylabel('Amplitude'); z = ademod(y,Fc,Fs,'fm'); subplot(3,1,2); plot(t,z); title('A Demodulated wave'); xlabel('Time'); ylabel('Amplitude'); subplot(3,1,3); plot(t,fftshift(fft(y))); title('A Spectrum of modulated wave'); xlabel('Frequency'); ylabel('Amplitude');

INDEX

S.No. 1.

Aim of Experiment Introduction to MatLab(Matrix Laboratory). a. Matrix Computation. b. To plot sine wave of frequency 200 Hz. c. To plot a pulse of width 10. d. Plot the spectrum (Amplitude and phase) of the pulse in (c). To observe the effects of the following distortions introduced by the channel due to its non-ideal characteristics. a. Amplitude Distortion(Due to non-ideal amplitude spectrum of the channel) b. Phase Distortion(Due to non-ideal phase spectrum of the channel) c. Distortion caused by band limited channel (ISI). To Verify a. Convolution Property b. Time Shifting Property c. Frequency Shifting 1. To generate an amplitude modulated wave using amod command and demodulate it using ademod command. 2. a) To generate an amplitude modulated wave (m = 1/2 ). b) Plot the spectrum of the amplitude modulated wave. To generate DSBSC wave using amod command and demodulate it using demod command. To generate a frequency modulated wave using amod command and demodulate it using ademod command. Plot the spectrum of the frequency modulated wave.

Signature

2.

3.

4.

5. 6.

7.

8.

Vous aimerez peut-être aussi