Beruflich Dokumente
Kultur Dokumente
Simulation of an FM signal with a single tone sinusoidal modulating signal. Plot its frequency spectrum.
WAVEFORMS: RED: FREQUENCY MODULATED SIGNAL BLUE: MODULATING SIGNAL
Carrier Frequency = 5000Hz Frequency of modulating signal = 50Hz Kf = 50; Am = 10 FREQUENCY SPECTRUM:
BAND WIDTH: 1100 Hz(approximately) Carrier Frequency = 1000Hz Frequency of modulating signal = 50Hz Kf = 0.1; Am = 10 RED: FREQUENCY MODULATED SIGNAL BLUE: MODULATING SIGNAL
MATLAB CODE:
%let m(t) = Am*cos(2*pi*fm*t) %integration(m(t)) = (Am/(2*pi*fm))Sin(2*pi*fm*t) % input kf % delta f = kf * Am %beta = (delta f)/fm clc; close; Ac = 5; kf = input('enter kf :'); fc = input('enter carrier frequency :'); fm = 50; Am = 10; t = 0:.00001:.1; delF = kf * Am; beta = delF / fm; fmd = Ac * cos(2*pi*fc*t + beta * sin(2*pi*fm*t)); bs = Am.*cos(2*pi*fm*t); figure(1) plot(t,bs,'b'); hold on; plot(t,fmd,'r'); grid on; fs = 100000; N = 2^nextpow2(length(t)); f = fs * (0 : N/2) / N; z = (2/N)*abs(fft(fmd,N)); figure(2); plot(f(1:fc/1.5),z(1:fc/1.5)); grid on;
MAJOR ASSIGNMENT 2 PROBLEM 2 Simulation of PM signal utilizing low frequency triangular waveform as a modulating signal.
WAVEFORMS: Carrier Frequency = 1000Hz Frequency of Modulating Signal = 50Hz Kp = 10; Am = 10
OBSERVATIONS: 1) On increasing phase sensitivity, Kp dependence of pulse modulated signal increases on modulating signal. So, modulation becomes better. 2) Higher Carrier wave frequency increases the variation of modulated signal thus make modulation better.
MATLAB CODE:
%let m(t) = integration(square(fm * t)-.5) %integration(m(t)) = integration(integration(square(t)-.5)) % input kf % delta f = kf * Am clc; close; Ac = 5; kf = input('enter kf :'); fc = input('enter carrier frequency :'); fm = 50; Am = 10; t = 0:.00001:.05; delF = kf * Am; beta = delF; bs = sawtooth(2*pi*fm*t,.5) + 1; fmd = Ac * cos(2*pi*fc*t + beta * bs);
figure(1) plot(t,Am*bs,'b'); hold on; plot(t,fmd,'r'); grid on; fs = 100000; N = 2^nextpow2(length(t)); f = fs * (0 : N/2) / N; z = (2/N)*abs(fft(fmd,N)); figure(2); plot(f(1:fc/1.5),z(1:fc/1.5)); grid on;
WAVEFORMS:
Modulated signal: Carrier Frequency = 1000Hz Frequency of Modulating Signal = 50Hz Kf = 10; Am = 10. Here, beta = 2 (Wide Band)
Demodulated signals: Carrier Frequency = 1000Hz Frequency of Modulating Signal = 50Hz Kf = 10; Am = 10. Here, beta = 2 (Wide Band)
Carrier Frequency = 1000Hz Frequency of Modulating Signal = 50Hz Kf = 1; Am = 10. Here, beta = 1/5 (Narrow Band)
Carrier Frequency = 1000Hz Frequency of Modulating Signal = 50Hz Kf = 0.1; Am = 10. Here, beta = 1/50 (Narrow Band)
Carrier Frequency = 5000Hz Frequency of Modulating Signal = 50Hz Kf = 10; Am = 10. Here, beta = 2 (Wide Band)
Carrier Frequency = 5000Hz Frequency of Modulating Signal = 50Hz Kf = 1; Am = 10. Here, beta = 0.2 (Narrow Band)
Carrier Frequency = 500Hz Frequency of Modulating Signal = 50Hz Kf = 0.1; Am = 10. Here, beta = .02 (Narrow Band)
Carrier Frequency = 500Hz Frequency of Modulating Signal = 50Hz Kf = 100; Am = 10. Here, beta = 20 (Wide Band)
Carrier Frequency = 1000Hz Frequency of Modulating Signal = 50Hz Kf = 100; Am = 10. Here, beta = 20 (Wide Band)
Observations: 1) Carrier wave with higher frequency gives smoother demodulation in comparison to lower frequencies. 2) As beta deviated more from unity, demodulation becomes better by using envelope detector. It gives similar results in both narrow band as well as in wide band signal.
MATLAB CODE:
%let m(t) = Am*cos(2*pi*fm*t) %integration(m(t)) = (Am/(2*pi*fm))Sin(2*pi*fm*t) % input kf % delta f = kf * Am %beta = (delta f)/fm clc; clear; syms t; Ac = 5; kf = input('enter kf :'); fc = input('enter carrier frequency :'); fm = 50; Am = 10; delF = kf * Am; beta = delF / fm; %modulated FM signal fmd = Ac * cos(2*pi*fc*t + beta * sin(2*pi*fm*t)); Bt = 2 * delF*(1 + 1/beta); bs = Am.*cos(2*pi*fm*t); %slope response a_slope = 1 k = pi * Bt *Ac; a = 2 * kf / Bt; y = k *(1 + a * bs)*cos(2*pi*fc*t + beta*bs + pi/2); z = k *(1 - a * bs)*cos(2*pi*fc*t + beta*bs + pi/2); i = 1; u(i) = 0; v(i) = 0; for t1= 0 : .0001 : .5 k1 = outp(u(i),.0001); k2 = outp(v(i),.0001); l1 = subs(y,t,t1); l2 = subs(z,t,t1); i = i + 1; if(k1 < l1) u(i) = l1; else u(i) = k1; end if(k2 < l2)
v(i) = l2; else v(i) = k2; end %disp(t1); end w = u - v; j = 1:i; figure(1) plot(j,w(j),'b'); grid on; % t2 = 0:.0001:.02; % figure(2) % plot(t2,subs(fmd,t,t2)); % grid on;
PROBLEM 4 Plot power spectral density and autocorrelation function of a Gaussian random process.
MATLAB Code: t = linspace(-10,10,1000); x = exp(-t.^2); figure; subplot(2,1,1); plot(t,x); title('Gaussian Function'); Rxx=xcorr(x); subplot(2,1,2); plot(Rxx); title('AutoCorrelation Function of Gaussian Process'); grid; freq=fft(Rxx); figure; plot(abs(freq))
The Autocorrelation function The time axis is not adjusted according to the time reference. But we can see its qualitative nature.
PSD : We get a flat PSD which is the fourier transform of the autocorrelation function.
Result: The Auto correlation and the PSD of the Gaussian random process is thus found.
Problem 5 Plot the distribution of the random variable Z = X2 + Y 2, where X and Y are Gaussian distributed real-valued random variables with unit variance and zero mean. Note: The given distribution Z is chi-square distribution. Code: % The joint distribution of x^2+y^2 is chi-square distribution of parameter % 2 (no of degrees of freedom) x=[-10:0.01:15]; %Range of values for which graph is plotted parameter=ones(1,length(x)); parameter=parameter+1; %making no of degrees of freedom 2 pdff=pdf('chi2',x,parameter); figure; plot(x,pdff);