Types of expression, MATLAB Programming


Each and every expression, or variable, has a type related with it. The MATLAB supports numerous types of values that are known as classes. A class is necessarily a combination of a type and the operations which can be performed on the values of that type. For illustration, there are various types to store different types of numbers.

For float or real numbers or in the other words numbers with a decimal place (example, 5.3), there are two basic types: single & double. The name of the type double is short for double precision; it stores the larger numbers than single. The MATLAB uses a floating point representation for these numbers.

For integers, there are lots of integer types; example, int8, int16, int32, & int64. The numbers in the names shows the number of bits used to store values of that type. For illustration, the type int8 uses eight bits together to store the integer and its sign. As one bit is used for the sign, that means the seven bits are used to store real number. Each bit stores the number in binary (0's or 1's), and 0 is also a possible value, that means that 2 ^ 7 - 1 or 127 is the largest number which can be stored. The range of values which can be stored in int8 is actually from -128 to +127. This given range can be found for any type by passing the name of the type as a string (that means in single quotes) to the functions intmin and intmax. For illustration,

>> intmin('int8')

ans =


>> intmax('int8')

ans =


The larger the number in the type name, the larger the number which can be stored in it. We will mostly use the type int32 whenever an integer type is needed.

The type char is used to store either single characters (example 'x') or strings that are sequences of the characters (example, cat). Both characters and strings are enclosed in single quotes.


Posted Date: 10/18/2012 4:00:02 AM | Location : United States

Related Discussions:- Types of expression, Assignment Help, Ask Question on Types of expression, Get Answer, Expert's Help, Types of expression Discussions

Write discussion on Types of expression
Your posts are moderated
Related Questions
how to implement visual cryptography on grayscale images

The fuel consumption of a certain make of car may not be exactly that rated by the manufacturer. Suppose ten cars of the same model were tested for combined city and highway fuel c

Variable number of input arguments: For illustration, the below function areafori has a variable number of input arguments, either the 1 or 2. The name of the function stands

Design and implement Binary digital modulation for a specific input signal frequency, sampling frequency and signal level for binary frequency shift keying (BFSK) by applying MATLA

Creating row Vectors: There are many ways to generate row vector variables. The most important way is to put the values which you want in the vector in square brackets, separa

Various commands for get the help: There are various commands which can serve as an introduction to MATLAB and allow you to get the help: info will show contact informatio

Write a Matlab function that computes y1= tan(x) and y2= sin(x)/cos(x), returns the difference |y1-y2| and prints a message whether the two are equal or not. Test your function for

Adaptive filters can also be used in other applications. Speech recognition, for example, is performed in a non-stationary environment, and therefore may require adaptive filtering

illustration of for loop: illustration, to print a column of numbers from 1 to 5: for i = 1:5 fprintf('%d\n',i) end   This loop can be entered in the Command Wi