There are also routines that let you find solutions to equations. For example, if Ax=b and you want to find x, a slow way to find x is to simply invert A and perform a left multiply on both sides (more on that later). It turns out that there are more efficient and more stable methods to do this (L/U decomposition with pivoting, for example). Matlab has special commands that will do this for you.

Before finding the approximations to linear systems, it is important to remember that if A and B are both matrices, then AB is not necessarily equal to BA. To distinguish the difference between solving systems that have a right or left multiply, Matlab uses two different operators, "/" and "\". Examples of their use are given below. It is left as an exercise for you to figure out which one is doing what.

Read more...

Once you are able to create and manipulate a matrix, you can perform many standard operations on it. For example, you can find the inverse of a matrix. You must be careful, however, since the operations are numerical manipulations done on digital computers. In the example, the matrix A is not a full matrix, but matlab's inverse routine will still return a matrix.

Read more...

Defining a matrix is similar to defining a vector. To define a matrix, you can treat it like a column of row vectors (note that the spaces are required!):

>> A = [ 1 2 3; 3 4 5; 6 7 8]

A =

1 2 3
3 4 5
6 7 8

You can also treat it like a row of column vectors:

Read more...

Once you master the notation you are free to perform other operations:

>> v(1:3)-v(2:4)

ans =

-2 -2 -2

For the most part Matlab follows the standard notation used in linear algebra. We will see later that there are some extensions to make some operations easier. For now, though, both addition subtraction are defined in the standard way. For example, to define a new vector with the numbers from 0 to -4 in steps of -1 we do the following:

Read more...

You can view individual entries in this vector. For example to view the first entry just type in the following:

>> v(1)

ans =

2

This command prints out entry 1 in the vector. Also notice that a new variable called ans has been created. Any time you perform an action that does not include an assignment matlab will put the label ans on the result.

Read more...

Defining a Vector

Matlab is a software package that makes it easier for you to enter matrices and vectors, and manipulate them. The interface follows a language that is designed to look a lot like the notation use in linear algebra. In the following tutorial, we will discuss some of the basics of working with vectors.

If you are running windows or Mac OSX, you can start matlab by choosing it from the menu. To start matlab on a unix system, open up a unix shell and type the command to start the software: matlab. This will start up the software, and it will wait for you to enter your commands. In the text that follows, any line that starts with two greater than signs (>>) is used to denote the matlab command line. This is where you enter your commands.

Almost all of Matlab's basic commands revolve around the use of vectors. A vector is defined by placing a sequence of numbers within square braces:

Read more...

Commands covered:
    • plot
      xlabel
      ylabel
      title
      grid
      axis
      stem
      subplot

The command most often used for plotting is plot, which creates linear plots of vectors and matrices; plot(t,y) plots the vector t on the x-axis versus vector y on the y-axis. There are options on the line type and the color of the plot which are obtained using plot(t,y,'option'). The linetype options are '-' solid line (default), '--' dashed line, '-.' dot dash line, ':' dotted line. The points in y can be left unconnected and delineated by a variety of symbols: + . * o x. The following colors are available options:

Read more...

A. Convolution

Commands covered:

      • conv
        deconv

 

To perform discrete time convolution, x[n]*h[n], define the vectors x and h with elements in the sequences x[n] and h[n]. Then use the command

Read more...

Note, the recent versions of Matlab utilize a state space model to represent a system (where a system sys is defined as sys = ss(A,B,C,D)). Many of the commands that are listed below have sys as the preferred input argument rather than num and den. In many cases, the online help for Matlab does not even indicate the argument list as shown below; however, in most cases, the argument list as shown below still works. The authors purposely choose not to present the material in the book or in this tutorial using sys since it may obscure details for junior and sophomore-level students. For more details on this notation, see Section 3.F.

A. Transfer Function Representation

Read more...

Commands covered:

        • dft
          idft
          fft
          ifft
          contfft

The dft command uses a straightforward method to compute the discrete Fourier transform. Define a vector x and compute the DFT using the command

X = dft(x)

The first element in X corresponds to the value of X(0).

The command idft uses a straightforward method to compute the inverse discrete Fourier transform. Define a vector X and compute the IDFT using the command

Read more...

Here you can learn matlab 2010 tutorials tips ,and buy cheap matlab 2010,just click the picture,you will go to my webshop. in my webshop ,you can find more other cheap software ,not only matlab 2010