0% found this document useful (0 votes)
121 views12 pages

The University of Faisalabad: Lab No. 1

The document describes several MATLAB experiments generating sinusoidal signals. It summarizes lab reports from an introductory signals and systems course. The labs introduce generating basic sinusoidal signals using MATLAB, adding harmonics to create square waves, using stem plots for discrete signals, manipulating signal ranges with linspace, and adding noise. The document provides the objective, software used, procedures, code, and resulting figures for each lab experiment.

Uploaded by

Arbab Aslam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
121 views12 pages

The University of Faisalabad: Lab No. 1

The document describes several MATLAB experiments generating sinusoidal signals. It summarizes lab reports from an introductory signals and systems course. The labs introduce generating basic sinusoidal signals using MATLAB, adding harmonics to create square waves, using stem plots for discrete signals, manipulating signal ranges with linspace, and adding noise. The document provides the objective, software used, procedures, code, and resulting figures for each lab experiment.

Uploaded by

Arbab Aslam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

The University Of Faisalabad

LAB NO. 1

Objective:
To generate a sinusoidal signal in matlab.

Softwares Used:
MATLAB R2011a

Procedure:

First of all I Open the Matlab Software.


I Open the window editor.
I Write the code for sinusoidal signal.
Set the initial value of wave at 0.
Set the final value of wave at 10.
The Wave lies from 0 to 10.
Then Take the screenshot of the matlab coding.
The screenshot of matlab coding is shown.

Coding of Program:
>> t=0:0.1:10;
>> y=sin(t);

>> plot(t,y);

Resulting Figure:
The following figure is shown when I pressed Enter.

The University Of Faisalabad


LAB NO. 02
Objective:
To generate a square wave from sin wave in matlab.

Software Used:
MATLAB R2011a

Procedure:

First of all I Open the Matlab Software.


The I Open the window editor.
After I Write the code for sinusoidal signal.
Set the initial value of wave at 0.
Set the final value of wave at 10.
The Wave lies from 0 to 10.
Then Add the 3rd, 5th, 7th 27th Harmonics in the sin wave.
The screenshot of matlab coding is shown.

Code Of Program

>> t=0:0.1:10;
>> y=sin(t);
>>
y=sin(t)+sin(3*t)/3+sin(5*t)/5+sin(7*t)/7+sin(9*t)/9+sin(11*t)/11+sin(13*t)/13+sin(15*t
)/15+sin(17*t)/17+sin(19*t)/19+sin(21*t)/21+sin(23*t)/23;

>> plot(t,y);

Resulting Figure:
The following figure is shown when I pressed Enter.

The University Of Faisalabad


LAB NO.03

Objective:
How to generate a discrete sin wave in matlab.

Software Used:
MATLAB R2011a

Procedure:

First of all I Open the Matlab Software.


Then I Open the window editor.
I Write the code for discrete sinusoidal signal.
Set the initial value of wave at 0.
Set the final value of wave at 10.
The Wave lies from 0 to 10.
For discrete signal use the command stem instead of plot.
The screenshot of matlab coding is shown.

Coding of Program:
>> t=0:0.1:10;
>> y=sin(t);
>> stem(t,y);

Resulting Figure:
The following figure is shown when I pressed Enter.

The University Of Faisalabad


LAB NO.04

Objective:
To generate a sin wave using linspace command in matlab.
How to generate a sin wave in matlab using linspace command.

Software Used:
MATLAB R2011a

Procedure:

First of all I Open the Matlab Software.


Then I Open the window editor.
I Write the code for sinusoidal signal.
Set the initial value of wave at -5.
Again Set the final value of wave at 5.
The Wave lies from -5 to 5.

Code of program:

>> x=linspace(5,-5);
>>y=sin(x);
>>plot(x,y);
>>xlabel('-5 < x < 5');

Resulting Figure:
The following figure is shown when I pressed Enter.

The University Of Faisalabad


LAB NO. 05

Objective:
To generate a sin wave using linspace command from -2 to 2 in matlab and label its
x-axis..

Tools Used:
MATLAB R2011a

PROCEDURE

First of all I Open the Matlab Software.


Then I Open the window editor.
I Write the code for sinusoidal signal.
Set the initial value of wave at -2 .
Again Set the final value of wave at 2.
Then Label the x-axis from -2 to 2.

Code of Program:
>> x=linspace(-2*pi,2*pi);
y=sin(x);
plot(x,y)
xlabel('-2/pi < x < 2/pi');

Resulting Figure:
The following figure is shown when I pressed Enter.

The University Of Faisalabad


LAB NO. 06

Objective:
To study the noise signal in sinusoidal signal.
How to interperate the noise signal.

Software Used:
MATLAB R2011a

PROCEDURE

First of all I open the Matlab Software


then I open the windows editor.
After this I Write the code for noise sinusoidal signal.
The screenshot of matlab coding is shown below.

Program Code:
>> N=200;
>> T=0.05;
>> t=(0:N-1)*T;
>> s=sin(2*pi*120*t);
>> plot(t,s)

Resulting Figure:
The following figure is shown when I pressed Enter.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy