0% found this document useful (0 votes)
103 views3 pages

Lab Manual No 03

This document is a lab manual for a digital image processing course covering MATLAB scripting and functions. It contains 8 tasks involving MATLAB operations on vectors and matrices such as creating vectors, performing element-wise operations, extracting portions of arrays, manipulating array dimensions, and applying functions to array elements. The document provides examples of MATLAB code and arrays to demonstrate various commands and functions for summarizing their effects. It is dated for a lab period from November 21-25, 2016 at the University of Engineering and Technology in Taxila, Pakistan.

Uploaded by

zain ai
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)
103 views3 pages

Lab Manual No 03

This document is a lab manual for a digital image processing course covering MATLAB scripting and functions. It contains 8 tasks involving MATLAB operations on vectors and matrices such as creating vectors, performing element-wise operations, extracting portions of arrays, manipulating array dimensions, and applying functions to array elements. The document provides examples of MATLAB code and arrays to demonstrate various commands and functions for summarizing their effects. It is dated for a lab period from November 21-25, 2016 at the University of Engineering and Technology in Taxila, Pakistan.

Uploaded by

zain ai
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/ 3

UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA

FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING


COMPUTER ENGINEERING DEPARTMENT

Digital Image Processing


Lab Manual No 03
Learning to write MATLAB Script and Functions

Dated:
21th November, 2016 to 25th November, 2016

Semester:
Autumn 2016

Computer Application in Engineering Design


Session:-2015 Computer

Lab Instructor:-Engr. Aamir Arsalan

UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA


FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
COMPUTER ENGINEERING DEPARTMENT

Lab Tasks:1. Create a vector of the even whole numbers between 31 and
75.
2. Let x = [2 5 1 6].
Add 16 to each element
Add 3 to just the odd-index elements
Compute the square root of each element
Compute the square of each element
3. Let x = [3 2 6 8]' and y = [4 1 3 5]' (NB. x and y should
be column vectors).
Add the sum of the elements in x to y.
Raise each element of x to the power specified by the
corresponding element in y.
Divide each element of y by the corresponding element
in x.
Multiply each element in x by the corresponding
element in y, calling the result "z".
Add up the elements in z and assign the result to a
variable called "w".
Compute x'*y - w and interpret the result.
4. Given x = [3 1 5 7 9 2 6], explain what the following
commands "mean" by summarizing the net result of the
command.
x(3)
x(1:7)
x(1:end)
x(1:end-1)
x(6:-2:1)
x([1 6 2 1 1])
sum(x)
5. Given the array A = [ 2 4 1 ; 6 7 2 ; 3 5 9], provide the
commands needed to
assign the first row of A to a vector called x1
assign the last 2 rows of A to an array called y
compute the sum over the columns of A
compute the sum over the rows of A
Computer Application in Engineering Design
Session:-2015 Computer

Lab Instructor:-Engr. Aamir Arsalan

UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA


FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
COMPUTER ENGINEERING DEPARTMENT

6. Given the arrays x = [1 4 8], y = [2 1 5] and A = [3 1 6; 5


2 7], determine which of the following statements will
correctly execute and provide the result.If the command
will not correctly execute, state why it will not. Using
the command whos may be helpful here.
x + y
x + A
x' + y
A - [x' y']
[x ; y']
[x ; y]
A 3

7. Given the array A = [2 7 9 7 ; 3 1 5 6 ; 8 1 2 5], explain


the results of the following commands:
A'
A(:,[1 4])
A([2 3],[3 1])
reshape(A,2,6)
A(:)
flipud(A)
fliplr(A)
[A A(end,:)]
A(1:3,:)
[A ; A(1:2,:)]
sum(A)
sum(A')
sum(A,2)
[ [ A ; sum(A) ] [ sum(A,2) ; sum(A(:)) ] ]
8. Given the array A from problem 7, above, provide the
command that will
assign the even-numbered columns of A to an array
called B
assign the odd-numbered rows to an array called C
convert A into a 4-by-3 array
compute the reciprocal of each element of A
compute the square-root of each element of A
Computer Application in Engineering Design
Session:-2015 Computer

Lab Instructor:-Engr. Aamir Arsalan

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