Posts

Showing posts from May, 2023

Build in Functions in Matlab

Image
  A built-in function is  part of the MATLAB executable . MATLAB does not implement these functions in the MATLAB language. Although most built-in functions have a . m file associated with them, this file only supplies documentation for the function. Matlab comes preloaded with many built-in functions that are very easy to use.  To use a function, type the name of the function in the command window followed by a parentheses. After the parentheses you can list the input arguments, which are seperated by comma’s. After you have entered the input arguments, close the expression with a parenthesis. Function inputs can range from one to many, and the some even take vectors or matrices as inputs. Matlab also has built-in matrix functions that come in very handy. We will explore some of the more common ones below. Our first example involves the use of the cosine function. The cosine function can take a vector or matrix of inputs and produces a vector or matrix of outputs. Rememb...

Using MATLAB as a calculator. Matlab Syntax

  As an example of a simple interactive calculation, just type the expression you want to evaluate. Let’s start at the very beginning. For example, let’s suppose you want to calculate the expression, 1 + 2 × 3. You type it at the prompt command ( >> ) as follows, >> 1+2*3 ans = 7 You will have noticed that if you do not specify an output variable, MATLAB uses a default variable ans , short for answer , to store the results of the current calculation. Note that the variable ans is created (or overwritten, if it is already existed). To avoid this, you may assign a value to a variable or output argument name. For example, >> x = 1+2*3 x = 7 will result in x being given the value 1 + 2 × 3 = 7. This variable name can always be used to refer to the results of the previous computations. Therefore, computing 4 x will result in >> 4*x ans = 28.0000 Examples: 7 / 0 % Divide by zero sin ( pi / 2 ) % sine of angle 90 o

Introduction to Matlab

Image
  The name MATLAB stands for MATrix LABoratory. MATLAB was written originally to provide easy access to matrix software developed by the LINPACK (linear system package) and EISPACK (Eigen system package) projects. MATLAB has many advantages compared to conventional computer languages (e.g., C, FORTRAN) for solving technical problems. MATLAB is an interactive system whose basic data element is an array that does not require dimensioning. The software package has been commercially available since 1984 and is now considered as a standard tool at most universities and industries world wide MATLAB is a programming language developed by MathWorks. It started out as a matrix programming language where linear algebra programming was simple. It can be run both under interactive sessions and as a batch job Local Environment Setup Setting up MATLAB environment is a matter of few clicks. The installer can be downloaded from Online Source MathWorks provides the licensed product, a trial version...