Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this document? Why not share!

- Digital Signal Processing Lab Manua... by UR11EC098 51137 views
- digital signal-processing-lab-manual by alshomi 1024 views
- Dsp manual completed2 by bilawalali74 10844 views
- DSP Lab Manual (10ECL57) - VTU Syll... by Ravikiran A 17504 views
- Dsp lab manual by Mukul Mohal 1717 views
- Digital signal processing (2nd ed) ... by Ramesh Sundar 21226 views

11,393 views

Published on

distributions

No Downloads

Total views

11,393

On SlideShare

0

From Embeds

0

Number of Embeds

4

Shares

0

Downloads

728

Comments

0

Likes

6

No embeds

No notes for slide

- 1. JNU/ECE/SPL-01/EC507 1 Signal Processing Lab-I Created By Jitendra Jangid EXPERIMENT-01 Aim:- Generation of Continuous and Discrete Elementary signals (Periodic and Non- periodic) using mathematical expression. Software Requirement-Matlab 7.0 Theory- Continuous-Time and Discrete-Time Signals: A signal x(t) is a continuous-time signal if t is a continuous variable. If t is a discrete variable, that is, x(t) is defined at discrete times, then x(t) is a discrete-time signal. Periodic and Non periodic Signals: A continuous-time signal x(t) is to be periodic with period T if there is a positive nonzero value of T for which X(t+T)=x(t) all t Any continuous-time signal which is not periodic is called a non-periodic signal. Periodic discrete-time signal are defined analogously. A sequence x[n] is periodic with period N if there is a positive integer N for which X[n+N]=x[n] all n Coding:- Continuous periodic time signal time= input('Enter The time duration = ') t=0:0.1:time ; F=1; y=cos(2*F*t*pi); plot(t,y); %plot command to plot the graph% xlabel('TIME'); ylabel('amplitude y(t)=cos(2*F*t*pi)'); title('continuous periodic signal') %title of the signal y2=sin(2*F*t*pi); figure; plot(t,y2); %plot command to plot the graph% xlabel('TIME'); ylabel('amplitude y2(t)=sin(2*F*t*pi)'); title('continuous periodic signal'); %title of the signal
- 2. JNU/ECE/SPL-01/EC507 2 Signal Processing Lab-I Created By Jitendra Jangid Discrete periodic time signal time= input('Enter The time duration = ') t=0:0.1:time ; F=1; y=cos(2*F*t*pi); stem(t,y); %plot command to plot the graph% xlabel('TIME'); ylabel('amplitude y(t)=cos(2*F*t*pi)'); title('discrete periodic signal') %title of the signal y2=sin(2*F*t*pi); figure; stem(t,y2); %plot command to plot the graph% xlabel('TIME'); ylabel('amplitude y2(t)=sin(2*F*t*pi)'); title('discrete periodic signal'); %title of the signal Non periodic continuous signal
- 3. JNU/ECE/SPL-01/EC507 3 Signal Processing Lab-I Created By Jitendra Jangid t=0:2:50; y=cos(t/2).*cos(t*pi/4) plot(y) xlabel('time') ylabel('amplitude') title('aperiodical continous signal ') Non periodic Discrete signal t=0:2:50; y=cos(t/2).*cos(t*pi/4) stem(y) xlabel('time') ylabel('amplitude') title('aperiodical discrete signal ')
- 4. JNU/ECE/SPL-01/EC507 4 Signal Processing Lab-I Created By Jitendra Jangid Result:- Various periodic and non-periodic signals has been studied.
- 5. JNU/ECE/SPL-01/EC507 5 Signal Processing Lab-I Created By Jitendra Jangid EXPERIMENT-02 AIM: Generation of various continuous and discrete unit step signals. Software Requirement- Matlab 7.0 Theory- Continuous time unit step signals is also a basic continuous time signal and is denoted by u(t) this function is defined as. U(t)= 1 t>0 0 t<0 Discrete time unit step signal:- U(n) = 1 n>=0 0 n<0 Coding:- Continuous unit step signal t1=0:5:50 t2=-50:5:0 y1=ones(size(t1)) y2=zeros(size(t2)) t=[t2 t1] y=[y2 y1] plot(t,y) xlabel('t') title('cont. unit step')
- 6. JNU/ECE/SPL-01/EC507 6 Signal Processing Lab-I Created By Jitendra Jangid Discrete Unit Step Signal:- n1=0:5:30 n2=-50:5:0 y1=ones(size(n1)) y2=zeros(size(n2)) n=[n2 n1] y=[y2 y1] stem(n,y) xlabel('n') title('discrete unit step') Result:-
- 7. JNU/ECE/SPL-01/EC507 7 Signal Processing Lab-I Created By Jitendra Jangid EXPERIMENT NO:3 Aim: Generation of Exponential and Ramp signals in Continuous & Discrete domain. Software used: Matlab 7.0 Theory: Continuous-time complex exponential and sinusoidal signals: x(t) = C*eat where C and a are in general complex numbers. The case a > 0 represents exponential growth. Some signals in unstable systems exhibit exponential growth. The case a < 0 represents exponential decay. Some signals in stable systems exhibit exponential decay Ramp signal : The ramp function ( ) may be defined analytically in several ways and definitions are:
- 8. JNU/ECE/SPL-01/EC507 8 Signal Processing Lab-I Created By Jitendra Jangid Continuous exponential signal n= input('Enter the value of N='); t=0:1:n; M=2; y1=M*exp(t*1); %multiplication factor m =1; y2=M*exp(t*2); %multiplication factor m =1; subplot(211) plot(t,y1) xlabel('time ') ylabel('ampitude'); title('Continuous exponential signal with m = 1 '); subplot(212) plot(t,y2) xlabel('time ') ylabel('ampitude'); title('Continuous exponential signal with m = 2');
- 9. JNU/ECE/SPL-01/EC507 9 Signal Processing Lab-I Created By Jitendra Jangid Discrete exponent signal: n= input('Enter the value of N='); t=0:1:n; M=2; y1=M*exp(t*1); %multiplication factor m =1; y2=M*exp(t*2); %multiplication factor m =1; subplot(211) stem(t,y1) xlabel('time ') ylabel('ampitude'); title('discrete exponential signal with m = 1 '); subplot(212) stem(t,y2) xlabel('time ') ylabel('ampitude'); title('discrete exponential signal with m = 2');
- 10. JNU/ECE/SPL-01/EC507 10 Signal Processing Lab-I Created By Jitendra Jangid Continuous ramp signal n= input('Enter the value of N='); t=0:1:n; y1=t; %multiplication factor m =1; y2=t*2; %multiplication factor m =1; subplot(211) plot(t,y1) xlabel('time ') ylabel('ampitude'); title('continuous ramp signal with m = 1 '); subplot(212) plot(t,y2) xlabel('time ') ylabel('ampitude'); title('continuous ramp signal with m = 2');
- 11. JNU/ECE/SPL-01/EC507 11 Signal Processing Lab-I Created By Jitendra Jangid Discrete ramp signal n= input('Enter the value of N='); t=0:1:n; y1=t; %multiplication factor m =1; y2=t*2; %multiplication factor m =1; subplot(211) stem(t,y1) xlabel('time ') ylabel('ampitude'); title('discrete ramp signal with m = 1 '); subplot(212) stem(t,y2) xlabel('time ') ylabel('ampitude'); title('discrete ramp signal with m = 2'); Result:
- 12. JNU/ECE/SPL-01/EC507 12 Signal Processing Lab-I Created By Jitendra Jangid EXPERIMENT NO:4 Aim: To generate continuous and discrete convolution time signal Software used: Matlab 7.0 Theory: Convolution theorem for continuous system:If the impulse response of an analog or continuous time system be h(t), it means that for an input δ(t) its output is h(t). Hence for all linear system its output for a shifted impulse δ(t-T) is h(t-T). The following are the mathematical representation of these operations: δ(t) h(t) δ(t-T) h(t-T) x(t) δ(t-T) x(T) h(t-T) ∫ x(T) δ(t-T) dT ∫ x(T) h(t-T) dT From the last two statements, we can say that an input x(T) δ(t-T) the output is x(T) h(t-T) and for an input of continuous summation or integration of x(T) δ(t-T), the output is also continuous summation of x(T) h(t-T). Therefore, we can write by the linearity of the system y(t)= ∫ x(T) h(t-T) dT The right hand side of the above equation is defined as convolution of x(t) with h(t) and now we can write it as follow: y(t)= convolution of x(t) and h(t) = x(t) * h(t) = ∫ x(T) h(t-T) dT The symbol ‘*’ stands for convolution. Convolution for discrete time function: If x(n) is applied as an input to a discret time system, the response y(n) of the system is given by y(n)= T[x(n)]=t[∑ x(k) δ(n-k)] to study LTI systems linear convolution plays an important role.
- 13. JNU/ECE/SPL-01/EC507 13 Signal Processing Lab-I Created By Jitendra Jangid Continuous convolution time system: t1=[-10:1:0]; t2=[0:1:2]; t3=[2:1:10]; x=zeros(size(t1)); y=ones(size(t2)); z=zeros(size(t3)); t=[t1,t2,t3]; a=[x,y,z]; subplot(2,2 ,1); plot(t,a,'m'); xlabel('time-->'); ylabel('u(t)-u(t-2)'); u1=[-11:1:0]; u2=[0:1:3]; u3=[3:1:11]; v1=zeros(size(u1)); v2=ones(size(u2)); v3=zeros(size(u3)); u=[u1,u2,u3]; b=[v1,v2,v3]; subplot(2,2,2); plot(u,b,'m') xlabel('time-->'); ylabel('u(t)-u(t-3)'); c=conv(y,v2); subplot(2,2,3); plot(c); xlabel('time-->'); ylabel('(u(t)-u(t-2))*(u(t)-u(t-3))');
- 14. JNU/ECE/SPL-01/EC507 14 Signal Processing Lab-I Created By Jitendra Jangid -10 -5 0 5 10 0 0.2 0.4 0.6 0.8 1 time--> u(t)-u(t-2) -15 -10 -5 0 5 10 15 0 0.2 0.4 0.6 0.8 1 time--> u(t)-u(t-3) 1 2 3 4 5 6 1 1.5 2 2.5 3 time--> (u(t)-u(t-2))*(u(t)-u(t-3)) Result:
- 15. JNU/ECE/SPL-01/EC507 15 Signal Processing Lab-I Created By Jitendra Jangid EXPIREMENT: 5 Aim: Adding and subtracting two given signals. (Continuous as well as Discrete signals) Software used: Matlab 7.0 Theory: Addition of two ram signal in continuous and discrete n manner Code: n= input('Enter the value of N='); t=0:1:n; y1=t; %multiplication factor m =1; y2=t*2; %multiplication factor m =2; y3=y1+y2; subplot(221) plot(t,y1); xlabel('time ') ylabel('ampitude'); title('continuous ramp signal with m = 1 '); subplot(222) plot(t,y2) xlabel('time ') ylabel('ampitude'); title('continuous ramp signal with m =2'); subplot(223); plot(t,y3); xlabel('time ') ylabel('ampitude'); title('addition of two continuous ramp signal with m = 1 and m =2'); subplot(224) stem(t,y3) xlabel('time ') ylabel('ampitude'); title('addition of ramp signal in DISCRETE in time');
- 16. JNU/ECE/SPL-01/EC507 16 Signal Processing Lab-I Created By Jitendra Jangid Addition and Subtraction of two discrete different signals a=[0 1 1 1 2 1 ] b=[1 0 1 1 1 2 ] c=a+b; d=a-b; subplot(221) plot(a); xlabel('time'); ylabel('amplitude'); title('first a signal ') subplot(222) plot(b); xlabel('time'); ylabel('amplitude'); title('second b signal ') subplot(223) plot(c); xlabel('time'); ylabel('amplitude'); title('addition of a and b signal ') subplot(224) plot(d);
- 17. JNU/ECE/SPL-01/EC507 17 Signal Processing Lab-I Created By Jitendra Jangid xlabel('time'); ylabel('amplitude'); title('substraction of a and b signal ') Addition and Subtraction of two discrete different signals a=[0 1 1 1 2 1 ] b=[1 0 1 1 1 2 ] c=a+b; d=a-b; subplot(221) stem(a); xlabel('time'); ylabel('amplitude'); title('first a signal ') subplot(222) stem(b); xlabel('time'); ylabel('amplitude'); title('second b signal ') subplot(223) stem(c);
- 18. JNU/ECE/SPL-01/EC507 18 Signal Processing Lab-I Created By Jitendra Jangid xlabel('time'); ylabel('amplitude'); title('addition of a and b signal ') subplot(224) stem(d); xlabel('time'); ylabel('amplitude'); title('substraction of a and b signal ') Result :
- 19. JNU/ECE/SPL-01/EC507 19 Signal Processing Lab-I Created By Jitendra Jangid EXPERIMENT: 6 Aim :To generate uniform random numbers between (0, 1). Software used: Matlab 7.0 Theory: r = rand(n) returns an n-by-n matrix containing pseudorandom values drawn from the standard uniform distribution on the open interval (0,1). r = rand(m,n) or r = rand([m,n]) returns an m-by- nmatrix. r = rand(m,n,p,...) or r = rand([m,n,p,...]) returns an m-by-n-by-p-by-... array. r = rand returns a scalar. r = rand(size(A)) returns an array the same size as A. r = rand(..., 'double') or r = rand(..., 'single') returns an array of uniform values of the specified class. r = rand(n) r = rand(m,n) r = rand([m,n]) r = rand(m,n,p,...) r = rand([m,n,p,...]) r = rand r = rand(size(A)) r = rand(..., 'double') r = rand(..., 'single') Random number generation in continuous and discrete manner n=input('Enter the tota number which is generated N='); y=rand(1,n) subplot(211) plot(y); xlabel('random numbers'); ylabel('amplitude'); title('continuous plot of Random Number 0-1') subplot(212) stem(y) xlabel('random numbers'); ylabel('amplitude'); title('discrete plot of Random Number 0-1')
- 20. JNU/ECE/SPL-01/EC507 20 Signal Processing Lab-I Created By Jitendra Jangid Result:
- 21. JNU/ECE/SPL-01/EC507 21 Signal Processing Lab-I Created By Jitendra Jangid EXPERIMENT: 7 Aim: To generate a random binary wave. Software used: Matlab 7.0 Generation of binary wave for random signal continuous and discrete manner n=input('Enter the tota number which is generated N='); j=0; y1=rand(1,n) y=round(y1) for i=1:n if y(i)== 1; j(i)=ones else j(i)=zeros end end stem(j) xlabel('no of random signal'); ylabel('amplitude'); title('plot of Random in ones and zeros 0-1')
- 22. JNU/ECE/SPL-01/EC507 22 Signal Processing Lab-I Created By Jitendra Jangid Result:
- 23. JNU/ECE/SPL-01/EC507 23 Signal Processing Lab-I Created By Jitendra Jangid EXPERIMENT 8 Aim : To generate random sequences with arbitrary distributions, means and variances for following : (a) Rayleigh distribution (b) Normal distributions: N(0,1). Software used: Matlab 7.0 Theory: Definition The Rayleigh pdf is The Rayleigh distribution is a special case of the Weibull distribution. If A and B are the parameters of the Weibull distribution, then the Rayleigh distribution with parameter b is equivalent to the Weibull distribution with parameters and B = 2. If the component velocities of a particle in the x and y directions are two independent normal random variables with zero means and equal variances, then the distance the particle travels per unit time is distributed Rayleigh. In communications theory, Nakagami distributions, Rician distributions, and Rayleigh distributions are used to model scattered signals that reach a receiver by multiple paths. Depending on the density of the scatter, the signal will display different fading characteristics. Rayleigh and Nakagami distributions are used to model dense scatters, while Rician distributions model fading with a stronger line-of-sight. Nakagami distributions can be reduced to Rayleigh distributions, but give more control over the extent of the fading. Parameters The raylfit function returns the MLE of the Rayleigh parameter. This estimate is Rayleigh distribution Coding x = [0:0.01:2]; p= raylpdf(x,0.5); subplot(211) plot(x,p) title('Continuous Rayleigh pdf')
- 24. JNU/ECE/SPL-01/EC507 24 Signal Processing Lab-I Created By Jitendra Jangid subplot(212) stem(x,p) title('Discrete Rayleigh pdf') Normal distributions: N(0,1). In probability theory, the normal (or Gaussian) distribution is a continuous probability distribution, defined on the entire real line, that has a bell-shaped probability density function, known as the Gaussian function or informally as the bell curve:[nb 1] The parameter μ is the mean or expectation (location of the peak) and σ 2 is the variance. σ is known as the standard deviation. The distribution with μ = 0 and σ 2 = 1 is called the standard normal distribution or the unit normal distribution. A normal distribution is often used as a first approximation to describe real-valued random variables that cluster around a single mean value.
- 25. JNU/ECE/SPL-01/EC507 25 Signal Processing Lab-I Created By Jitendra Jangid Coding : x = -5:(1/100):5; mu = 0; sigma = 1; k = 1/(sigma*sqrt(2*pi)); y = k*exp(-((x-mu).^2)/(2*sigma^2)); hold off plot(x,y,'b.-') hold on mu = 0.5; sigma = 1.5; k = 1/(sigma*sqrt(2*pi)); y = k*exp(-((x-mu).^2)/(2*sigma^2)); plot(x,y,'r.-') mu = -.2; sigma = 0.5; k = 1/(sigma*sqrt(2*pi)); y = k*exp(-((x-mu).^2)/(2*sigma^2)); plot(x,y,'k.-')
- 26. JNU/ECE/SPL-01/EC507 26 Signal Processing Lab-I Created By Jitendra Jangid EXPERIMENT 9 Aim: To plot the probability density functions. Find mean and variance for the above distributions Software used: Matlab 7.0 Theory: A probability density function is most commonly associated with absolutely continuous univariate distributions. A random variable X has density f, where f is a non- negative Lebesgue-integrable function, if: Hence, if F is the cumulative distribution function of X, then: and (if f is continuous at x) Intuitively, one can think of f(x) dx as being the probability of X falling within the infinitesimal interval [x, x + dx]. Coding : Random number distribution data = [1 2 3 3 4]; %# Sample data xRange = 0:10; %# Range of integers to compute a probability for N = hist(data,xRange); %# Bin the data plot(xRange,N./numel(data));%# Plot the probabilities for each integer xlabel('Integer value'); ylabel('Probability');
- 27. JNU/ECE/SPL-01/EC507 27 Signal Processing Lab-I Created By Jitendra Jangid data = [1 2 3 3 4]; %# Sample data xRange = 0:10; %# Range of integers to compute a probability for N = hist(data,xRange); %# Bin the data stem(xRange,N./numel(data)); %# Plot the probabilities for each integer xlabel('Integer value'); ylabel('Probability');
- 28. JNU/ECE/SPL-01/EC507 28 Signal Processing Lab-I Created By Jitendra Jangid Normal distribution N( mu , sigma ) Code: %% Explore the Normal distribution N( mu , sigma ) mu = 100; % the mean sigma = 15; % the standard deviation xmin = 70; % minimum x value for pdf and cdf plot xmax = 130; % maximum x value for pdf and cdf plot n = 100; % number of points on pdf k = 10000; % number of random draws for histogram % create a set of values ranging from xmin to xmax x = linspace( xmin , xmax , n ); p = normpdf( x , mu , sigma ); % calculate the pdf plot(x,p) xlabel( 'x' ); ylabel( 'pdf' ); title( 'Probability Density Function' );
- 29. JNU/ECE/SPL-01/EC507 29 Signal Processing Lab-I Created By Jitendra Jangid Code for 'Cumulative Density Function' mu = 100; % the mean sigma = 15; % the standard deviation xmin = 70; % minimum x value for pdf and cdf plot xmax = 130; % maximum x value for pdf and cdf plot n = 100; % number of points on pdf k = 10000; % number of random draws for histogram % create a set of values ranging from xmin to xmax x = linspace( xmin , xmax , n ); c = normcdf( x , mu , sigma ); % calculate the cdf plot( x , c ); xlabel( 'x' ); ylabel( 'cdf' ); title( 'Cumulative Density Function' );

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment