0% found this document useful (0 votes)
75 views13 pages

SNS Lab 01 SP 2020

This document is a laboratory manual for an introduction to MATLAB course. It outlines the learning objectives of becoming familiar with the MATLAB interface and basic functionality like arithmetic operators, variables, and matrix manipulation. It describes the MATLAB software and applications. It also provides instructions on starting MATLAB and describes the various desktop tools available in the MATLAB window like the command window, command history, workspace browser, variable tab, and current folder. The document concludes with example tasks for students to complete in MATLAB and includes code to find the area of a circle and matrix operations.
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)
75 views13 pages

SNS Lab 01 SP 2020

This document is a laboratory manual for an introduction to MATLAB course. It outlines the learning objectives of becoming familiar with the MATLAB interface and basic functionality like arithmetic operators, variables, and matrix manipulation. It describes the MATLAB software and applications. It also provides instructions on starting MATLAB and describes the various desktop tools available in the MATLAB window like the command window, command history, workspace browser, variable tab, and current folder. The document concludes with example tasks for students to complete in MATLAB and includes code to find the area of a circle and matrix operations.
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/ 13

Signals and Systems

(EL-223)

LABORATORY MANUAL
Spring 2020

Dr. Shahzad Saleem

Engr. Fakhar Abbas

INTRODUCTION TO MATLAB

(LAB # 01)
Student Name: ______________________________________________

Roll No: ________________ Section: ____


Date performed: _____________, 2020

MARKS AWARDED: ________ / 20

NATIONAL UNIVERSITY OF COMPUTER AND EMERGING SCIENCES, ISLAMABAD

Prepared by: Engr. Fakhar Abbas Version: 3.00

Verified by: Dr. Waqas bin Abbas, Dr. Shahzad Saleem Updated: Jan 19,2020
Introduction to MATLAB LAB 01
____________________________________________________________________________________________________________________________________________________________

1. Learning Objectives:
In this lab, you will learn:
 The interface of MATLAB
 Basic arithmetic operators
 MATLAB variables
 Matrix manipulation

2. Software Used:
MATLAB

3. Introduction:

MATLAB (stands for Matrix Laboratory), it integrates computation, visualization, and


programming in an easy-to-use environment, where problems and solutions are expressed in
familiar mathematical notation.

Applications:
MATLAB is being used in multiple applications including:
i- Image Processing
ii- Communication systems
iii- Application development, including GUI
iv- Math and Computation
v- Algorithm development
vi- Modeling, simulation and prototyping
vii- Control Systems
viii- Robotics

SIGNALS AND SYSTEMS LAB NUCES FAST, ISLAMABAD Page 2 of 13


Introduction to MATLAB LAB 01
Examples:

• Matrix computations and linear algebra


• Solving nonlinear equations
• Numerical solution of differential equations
• Mathematical optimization
• Statistics and data analysis
• Signal processing
• Modelling of dynamical systems
• Solving partial differential equations
• Simulation of engineering systems

Strengths of MATLAB

• MATLAB is relatively easy to learn.


• MATLAB code is optimized to be relatively quick when performing matrix operations.
• MATLAB may behave like a calculator or as a programming language.
• MATLAB is interpreted, errors are easier to fix.

Starting MATLAB:

Start MATLAB by clicking on it in the Start menu.


You will see the MATLAB window as shown in Fig. given below:

Figure 1. MATLAB layout

SIGNALS AND SYSTEMS LAB NUCES FAST, ISLAMABAD Page 3 of 13


Introduction to MATLAB LAB 01
Desktop Tools
1. Command Window
Use the Command Window to enter variables and run functions and M-files.

Figure 2. Command window

2. Command History:
Statements you enter in the Command Window are logged in the Command History.
In the Command History, you can view previously run statements, and copy and execute selected
statements.
Enter a command “commandhistory” in Command Window to see commands history.

Figure 3. Command History

SIGNALS AND SYSTEMS LAB NUCES FAST, ISLAMABAD Page 4 of 13


Introduction to MATLAB LAB 01

Figure 4. Method to dock command history window

Figure 5. Commands History

3. Workspace Browser:
The MATLAB workspace consists of the set of variables (named arrays) built up
during a MATLAB session and stored in memory.

Figure 6. MATLAB Variables

SIGNALS AND SYSTEMS LAB NUCES FAST, ISLAMABAD Page 5 of 13


Introduction to MATLAB LAB 01
4. Variable Tab:
• Double-click a variable in the Workspace browser to see it in the Variable Tab.
• Use the Variable Tab to view and edit a visual representation of one- or two-dimensional
numeric arrays, strings, and cell arrays of strings that are in the workspace.

Figure 7. MATLAB Variable values

5. Current Folder:
It lists all the files that are available in current directory.

Figure 8. MATLAB directory

SIGNALS AND SYSTEMS LAB NUCES FAST, ISLAMABAD Page 6 of 13


Introduction to MATLAB LAB 01

SIGNALS AND SYSTEMS LAB NUCES FAST, ISLAMABAD Page 7 of 13


Introduction to MATLAB LAB 01

SIGNALS AND SYSTEMS LAB NUCES FAST, ISLAMABAD Page 8 of 13


Introduction to MATLAB LAB 01

SIGNALS AND SYSTEMS LAB NUCES FAST, ISLAMABAD Page 9 of 13


Introduction to MATLAB LAB 01

SIGNALS AND SYSTEMS LAB NUCES FAST, ISLAMABAD Page 10 of 13


Introduction to MATLAB LAB 01

SIGNALS AND SYSTEMS LAB NUCES FAST, ISLAMABAD Page 11 of 13


Introduction to MATLAB LAB 01

SIGNALS AND SYSTEMS LAB NUCES FAST, ISLAMABAD Page 12 of 13


Introduction to MATLAB LAB 01
TASKS:
Solve these questions in MATLAB and write answers/code in the manual. Submit your manual and
Script files on SLATE before leaving the lab. [ Total Marks = 20]

Q.1 Run the MATLAB help desk by typing doc. The doc provides a hypertext interface to the
MATLAB documentation. [1]

Q.2 Use MATLAB as a calculator. Try different mathematical operations. [1]

Q.3 Create a vector: [1+1+3]

a. ‘A’ of even whole numbers between 31 and 75.


b. ‘B’ of odd whole numbers between 75 and 131.
c. ‘C” of all numbers that are divisible by 4 between 0 to 100.

Q.4 Make sure that you understand the colon notation. In particular, explain in words what the
following MATLAB code will produce. [5]

a. 0:6
b. 2 : 4 : 17
c. 99 : -1 : 88
d. 2 : (1/9) : 4
e. pi * [ 0:0.1:2 ];

Q. 5 Using MATLAB find area of circle (πr2) where r=3. [2]

Q.6 Find 𝐴𝐵 and 𝐴𝐵 −1 where A and B are 3x3 matrices. [6]

SIGNALS AND SYSTEMS LAB NUCES FAST, ISLAMABAD Page 13 of 13

You might also like