barua_3713908_matlabf_function

barua_3713908_matlabf_function - or Y = ones[m n p The size...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
School of Electrical, Computer and Telecommunications Engineering MATLAB Functions: A Technical Summary Note on MATLAB ECTE906 - Assignment 1/Part3: Function Name: ones Category: Function Definition Create array of all ones. Syntax Y = ones(n) Y = ones(m,n) Y = ones([m n]) Y = ones(m,n,p,. ..) Y = ones([m n p ...]) Y = ones(size(A)) ones(m, n,. ..,classname) ones([m,n,. ..],classname) Background Theory This function creates an array of all ones. For a given dimension, it creates the array/matrix comprising all 1’s. Very useful tool for matrix multiplication and mathematical manipulation. Input/Output Requirement Syntax Input Requirement Output Requirement Y = ones(n) n should be a scalar, otherwise error message appears. n -by- n matrix of 1’ s Y = ones(m,n) or Y = ones([m n]) The size inputs m , n should be nonnegative integers. Negative integers are treated as 0. m -by- n matrix of 1’s Y = ones(m,n,p,.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ..) or Y = ones([m n p . ..]) The size inputs m , n , p , ... should be nonnegative integers. Negative integers are treated as 0. m-by-n-by-p-by-... array of 1’ s. Y = ones(size(A)) Matrix A array of 1’ s that is the same size as A ones(m,n,. ..,classname) or ones([m,n,. ..],classname) classname can have the following values: 'double' , 'single' , 'int8' , 'uint8' , 'int16' , 'uint16' . m-by-n-by-. .. array of 1’s of data type classname Sample Code: The following code creates a 2-by-5 matrix of 1’s. Y= ones(2,5,'int16') Sample Output: Y = 1 1 1 1 1 1 1 1 1 1 Family Name: KINGSHUK First Name: BARUA Student Number: 3713908 : ECTE906 - Assignment 1 -P.Doulai Instructions/Guidelines (MATLAB Tasks/Tut/Function/Lab Report) Mathematics -Elementary Matrices and Arrays...
View Full Document

Ask a homework question - tutors are online