MATLAB FUNCTION:-Squareroot(sqrt)

School of Electrical, Computer and Telecommunications Engineering, University of Wollongong

ECTE906 - Assignment 1 -P.Doulai Instructions/Guidelines (MATLAB Tasks/Tut/Function/Lab Report)

A Technical Summary Note on MATLAB Functions                                                                            ECTE906 - Assignment 1/Part3:

Function Name:- Squareroot                                                      Category:Exponential

Function Definition:-

Generally squareroot functions are done mathematically in calculator,we can also do squareroots in matlab by using function called squareroot.The squareroot function syntax is given by sqrt(x).function returns the square root of element of x that are complex.

There are also other square root functions like matrix square root (sqrtm) and realsquare root.In matrix square root function the matrices square roots are done.

Background Theory:-

There are also other square root functions like matrix square root (sqrtm) and realsquare root.In matrix square root function the matrices square roots are done.

function computes the square root of a fi object using a bisection algorithm.

·         c = sqrt(a) returns the square root of fi object a with the same fimath object as a.Intermediate quantities are also calculated using the fimath object of a. The numerictype object of c is determined automatically for you using and internal rule.

·         c = sqrt(a,T) returns the square root of fi object a with numerictype object T and the same fimath object as a. Intermediate quantities are calculated using the fimath object of a.

·         c = sqrt(a,F) returns the square root of fi object a with fimath object F. Intermediate quantities are also calculated using fimath object F. The numerictype object of c is determined automatically for you using and internal rule. When a is a built-in double or single data type, this syntax is equivalent to c = sqrt(a) and the fimath object F is ignored.

·         c = sqrt(a,T,F) returns the square root fi object a with numerictype object T and fimath object F. Intermediate quantities are also calculated using fimath object F.

sqrt does not support complex, negative-valued, or [Slope Bias] inputs.

Internal Rule

For syntaxes where the numerictype object of the output is not specified as an input to the sqrt function, it is automatically calculated according to the following internal rule.

sig=sig

W=ceil(W/2)

Data Type Propagation Rules

For syntaxes for which you specify a numerictype object T, the sqrt function follows the data type propagation rules listed in the following table. In general, these rules can be summarized as "floating-point data types are propagated." This allows you to write code that can be used with both fixed-point and floating-point inputs.

 Data Type of Input fi Object a Data Type of numerictype object T Data Type of Output c Built-in double Any Built-in double Built-in single Any Built-in single fiFixed fiFixed Data type of numerictype object T fiScaledDouble fiFixed ScaledDouble with properties of numerictype object T fidouble fiFixed fidouble fisingle fiFixed fisingle Any fi data type fidouble fidouble Any fi data type fisingle fisingle

Input/Output Requirement:-

The input should be given in brackets other wise matlab function will not obtain it shows undefined  function.The output will be stored in ans or if any variable is given declared to answer then the output value is stored in to that.

Example:-

>> c=sqrt(16) %where the input is given in brackets and the output obtained is stored in c

c =

4

Sample Code :-

>> sqrt((-4:16)')

ans =

0 + 2.0000i

0 + 1.7321i

0 + 1.4142i

0 + 1.0000i

0

1.0000

1.4142

1.7321

2.0000

2.2361

2.4495

2.6458

2.8284

3.0000

3.1623

3.3166

3.4641

3.6056

3.7417

3.8730

4.0000

References:-

MATLAB 7.7.0(R2008b) ,searched from matlab functions