You are on page 1of 11

Amplitude Modulation clear all T = 1/100; fm = 0.25; fc = 10; mt = sin(2*pi*fm*[0:T:10]); subplot (3,1,1); plot(mt) ct = sin(2*pi*fc*[0:T:10]); subplot(3,1,2); plot(ct) yt = mt.

*ct; [ Array Operator ] subplot(3,1,3) plot(yt)

%The amplitude modulation(AM)waveform in time and frequency domain.%fm=20HZ,fc=500HZ,Vm=1V,Vc=1V,t=0:0.00001:0.09999 % setting fm=20; fc=500; vm=1; vc=1; % x-axis:Time(second) t=0:0.00001:0.09999; f=0:1:9999; % y-axis:Voltage(volt) wc=2*pi*fc; wm=2*pi*fm; V1=vc+vm*sin(wm*t); V2=-(vc+vm*sin(wm*t)); Vm=vm*sin(wm*t); Vc=vc*sin(wc*t); Vam=(1+sin(wm*t)).*(sin(wc*t)); Vf=abs(fft(Vam,10000))/10000;

% Plot figure in time domain figure; plot(t,Vam); hold on; plot(t,V1,'r'),plot(t,V2,'r'); title('AM waveform time-domain'); xlabel('time'), ylabel('amplitude'); grid on;

% Plot figure in frequency domain figure;

plot(f*10,Vf); axis([(fc-2*fm) (fc+2*fm) 0 0.6]); title('AM waveform frequency-domain'); xlabel('frequency'), ylabel('amplitude'); grid on;

%Plot modulating signal figure; plot(t,Vm); title('AM modulating signal'); xlabel('time'), ylabel('amplitude'); grid on;

%Plot carrier signal figure; plot(t, Vc); title('AM carrier signal'); xlabel('time'), ylabel('amplitude'); grid on; clear;

Q. 1. What is modulation? Q. 2. Which are the three discrete frequencies in AM? Q. 3 How many sidebands in AM? Q. 4. What is the unit of modulation index in AM? Q. 5. Where the modulation index lies? Q.1. What is the most commonly used demodulator? ( Envelope , Square law ) Q.2. What is the required oscillator frequency in AM receiver? Q.3. How AM signals with large carrier are detected? (Square law detect low level AM & Vice vers ) Q.4. How much bandwidth required for AM wave? Q.5. List out the advantages of Amplitude modulation.

Q.1. what frequency deviation in FM? Q.2. Which is the useful parameter for determination of bandwidth? Q.3. How many sidebands in FM? Q.4. Which are significant sidebands?. Q.5. What is VCO?

Q.1. what is modulation index in FM? Q.2. Why the power is same in FM modulation and demodulation? Q.3. Write the two types of phase difference discriminator? ( Foster Seeley, Ratio ) Q.4. write the disadvantage of balanced slope discriminator? Q.5. what is the merit of ratio detector? AM Receiver IF 455k FM Receiver IF 10.7M

Program For ASK fc=30; g=[1 1 0 1 0 0 1 1 1 0]; %modulante n=1; while n<=length(g) if g(n)==0 tx=(n-1)*0.1:0.1/100:n*0.1; p=(1)*sin(2*pi*fc*tx); plot(tx,p,'LineWidth',1.5);grid on; hold on; else t=(n-1)*0.1:0.1/100:n*0.1; p=(2)*sin(2*pi*fc*t); plot(tx,p,'LineWidth',1.5);grid on; hold on; end n=n+1; end

clc; %getting code word size and block size n = input('Enter the length of codeword: '); length = input('Enter the length of input stream: '); trans_bits = input('Enter the bits (zeros and ones): '); block_size = input('Enter the block size (factor of length): '); % to segment the input stream into blocks %creating message vectors no_of_msg_vectors = 2^block_size; disp('no_of_msg_vectors: ') disp(no_of_msg_vectors) msg_vectors=[]; for i=0:1:no_of_msg_vectors-1 msg_vectors=[msg_vectors ; dec2bin(i,block_size)]; end disp('message vectors are: ') disp(msg_vectors) %generating bits to be transmitted parity_column = n-block_size; temp = parity_column; parity_matrix=[ ]; disp('bits to be transmitted: ') %splitting input string into parity rows for i=1:parity_column:length a1=trans_bits(i:temp); for j=1:i+temp:parity_column parity_matrix = [parity_matrix ; a1]; %M=[M ; dec2bin(i,4)]; end temp=temp+parity_column; end disp('parity matrix: ') disp(parity_matrix) %generating identity matrix identity_matrix = eye(block_size) %creating generator matrix g_matrix=[ ]; g_matrix= horzcat(parity_matrix, identity_matrix) %generating codeword codewd_matrix=[]; codewd_matrix=msg_vectors*g_matrix; for i=1:1:no_of_msg_vectors for j=1:1:n if mod(codewd_matrix(i,j),2)==0 codewd_matrix(i,j)=0; else codewd_matrix(i,j)=1; end end end codewd_matrix %transmission of a code word selected_word=input('Enter the codeword to be transmitted'); trans_word=codewd_matrix(selected_word,:) copy_trans=trans_word;

e_pos=input('Enter the bit position to be changed '); if(copy_trans(1,e_pos)==0) copy_trans(1,e_pos)=1; else copy_trans(1,e_pos)=0; end %decoding the received word received_word=copy_trans parity_t=parity_matrix' identity_mat1=eye(n-block_size) hamming_matrix=[identity_mat1,parity_t] %Error Detection syndrome=received_word*hamming_matrix'; disp('Transpose of Hamming Matrix: ') disp(hamming_matrix') hamming_transpose=hamming_matrix'; for i=1:1:parity_column if mod(syndrome(i),2)==0 syndrome(i)=0; else syndrome(i)=1; end end syndrome for i=1:1:n if syndrome(1,:)==hamming_transpose(i,:) e_bit =i; %errored bit end end disp('The corrupted bit is ') e_bit %Error Correction if received_word(1,e_bit)==1 received_word(1,e_bit)=0; else received_word(1,e_bit)=1; end disp('Corrected Code Word'); received_word disp('Original Code word'); trans_word OUTPUT: Enter the length of codeword: 7 Enter the length of parity stream: 12 Enter the bits (zeros and ones): [1 1 0 0 1 1 1 1 1 0 0 1] Enter the block size (factor of length): 4 no_of_msg_vectors: 16

message vectors are: 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 parity matrix: 110 011 111 001 identity_matrix = 1000 0100 0010 0001

g_matrix = 1101000 0110100 1110010 0010001 codewd_matrix = 0000000 0010001 1110010 1100011 0110100 0100101 1000110 1010111 1101000 1111001 0011010 0001011 1011100 1001101 0101110 0111111 Enter the codeword to be transmitted 6 trans_word = 0100101 Enter the bit position to be changed 4 received_word =

0101101 parity_t = 1010 1110 0111 identity_mat1 = 100 010 001 hamming_matrix = 1001010 0101110 0010111 Transpose of Hamming Matrix: 100 010 001 110 011 111 001 syndrome = 110 The corrupted bit is e_bit = 4 Corrected Code Word

received_word = 0100101 Original Code word trans_word = 0100101