# In Matlab

Real component of a complex scalar, specified as a scalar.

MATLAB cell array can hold different sizes and types of data in an array. Cell arrays provide a more flexible way to store strings of varying length. The cellstr function converts a character array into a cell array of strings. Matlab algorithm (e.g., ode45, ode23) Handle for function containing the derivatives Vector that speciﬁecs the interval of the solution (e.g., t0:5:tf) A vector of the initial conditions for the system (row or column) An array. The solution of the ODE (the values of the state at every time).! A number of Matlab m-files for everyday work is available too. Other EA implementations. Over the years we collected links to other implementations of Evolutionary Algorithms in Matlab. This is a good starting point for comparing other implementations with the capabilities of the GEATbx. Matlab Multithreading, EASY: making a multithreaded matlab program in five minutes:matlab is excellent, it makes it very easy to do things that would be very compicated and annoying in lower level languages (e.g. The main large flaw of matlab is that it does not inherent. MATLAB matches all characters in the name exactly except for the wildcard character., which can match any one or more characters. Examples Locate all files with names that start with january and have a.mat file extension.

**Data Types: **`single`

`double`

Imaginary component of a complex scalar, specified as a scalar.

If `b`

is `double`

, you canuse the character, `i`

, without a multiplicationsign as a suffix in forming the complex numerical constant.

**Example: **`7i`

If `b`

is `single`

, you mustuse a multiplication sign when forming the complex numerical constant.

**Example: **`single(7)*i`

**Data Types: **`single`

`double`

`x`

— Real component of complex array

scalarvectormatrixmultidimensional array

Real component of a complex array, specified as a scalar, vector, matrix, or multidimensional array.

The size of `x`

must match the size of `y`

,unless one is a scalar. If either `x`

or `y`

isa scalar, MATLAB^{®} expands the scalar to match the size of theother input.

`single`

can combine with `double`

.

**Data Types: **`single`

`double`

`y`

— Imaginary component of complex array

scalarvectormatrixmultidimensional array

Imaginary component of a complex array, specified as a scalar, vector, matrix, or multidimensional array.

The size of `x`

must match the size of `y`

,unless one is a scalar. If either `x`

or `y`

isa scalar, MATLAB expands the scalar to match the size of theother input.

`single`

can combine with `double`

.

**Data Types: **`single`

`double`

- Matlab Tutorial

- MATLAB Advanced

- MATLAB Useful Resources

- Selected Reading

MATLAB environment behaves like a super-complex calculator. You can enter commands at the >> command prompt.

MATLAB is an interpreted environment. In other words, you give a command and MATLAB executes it right away.

## Hands on Practice

Type a valid expression, for example,

And press ENTER

When you click the Execute button, or type Ctrl+E, MATLAB executes it immediately and the result returned is −

Let us take up few more examples −

When you click the Execute button, or type Ctrl+E, MATLAB executes it immediately and the result returned is −

Another example,

When you click the Execute button, or type Ctrl+E, MATLAB executes it immediately and the result returned is −

Another example,

### In Matlab Meaning

Another example,

MATLAB provides some special expressions for some mathematical symbols, like pi for π, Inf for ∞, i (and j) for √-1 etc. **Nan** stands for 'not a number'.

## Use of Semicolon (;) in MATLAB

Semicolon (;) indicates end of statement. However, if you want to suppress and hide the MATLAB output for an expression, add a semicolon after the expression.

For example,

## Adding Comments

The percent symbol (%) is used for indicating a comment line. For example,

### In Matlab Language

You can also write a block of comments using the block comment operators % { and % }.

The MATLAB editor includes tools and context menu items to help you add, remove, or change the format of comments.

## Commonly used Operators and Special Characters

MATLAB supports the following commonly used operators and special characters −

Operator | Purpose |
---|---|

+ | Plus; addition operator. |

- | Minus; subtraction operator. |

* | Scalar and matrix multiplication operator. |

.* | Array multiplication operator. |

^ | Scalar and matrix exponentiation operator. |

.^ | Array exponentiation operator. |

Left-division operator. | |

/ | Right-division operator. |

. | Array left-division operator. |

./ | Array right-division operator. |

: | Colon; generates regularly spaced elements and represents an entire row or column. |

( ) | Parentheses; encloses function arguments and array indices; overrides precedence. |

[ ] | Brackets; enclosures array elements. |

. | Decimal point. |

… | Ellipsis; line-continuation operator |

, | Comma; separates statements and elements in a row |

; | Semicolon; separates columns and suppresses display. |

% | Percent sign; designates a comment and specifies formatting. |

_ | Quote sign and transpose operator. |

._ | Nonconjugated transpose operator. |

= | Assignment operator. |

## Special Variables and Constants

MATLAB supports the following special variables and constants −

Name | Meaning |
---|---|

ans | Most recent answer. |

eps | Accuracy of floating-point precision. |

i,j | The imaginary unit √-1. |

Inf | Infinity. |

NaN | Undefined numerical result (not a number). |

pi | The number π |

## Naming Variables

Variable names consist of a letter followed by any number of letters, digits or underscore.

### In Matlab Operators Work On

MATLAB is **case-sensitive**.

Variable names can be of any length, however, MATLAB uses only first N characters, where N is given by the function **namelengthmax**.

## Saving Your Work

The **save** command is used for saving all the variables in the workspace, as a file with .mat extension, in the current directory.

For example,

### Ln Function In Matlab

You can reload the file anytime later using the **load** command.