1:55 PM

basic things

here we shall start learning matlab from the basic stuffs.

1. n=0:10
               This means that n is a one-dimensional array or a row matrix with values taking from 0 to 10 with an interval of 1,i.e.,[0 1 2 3 ... 9 10]

2.n=0:0.5:10
                This means that n is a one-dimensional array or a row matrix with values from 0 to 10 with an interval of 0.5,i.e.,[0 0.5 1 1.5 ... 9.5 10]

3.use of a ;
                 If we put a semicolon at the end of an equation or an expression matlab does not display the resulting values.And if we want to see the values we DO NOT  put a semicolon.

4.x(n)
          x(n) is an array of n elements under the family named x.each number in the array is allocated an address but the address starts from 1 and ends at n.So lets do a program that allocates values to the array x(n) to each address.

n=1:10;
x(n)=n;

 This program stores the value n at each of the nth address of the array.
Therefore x=[1 2 3 4 5 6 7 8 9 10]

So if you wanna see the values allocated to the array do either of the following:

1.Remove the ; from the second line of the above programming.
2.Type x and press enter in the command window.

Now if you wanna see the value stored at the address location 5 simply type x(5) and press enter.See the result.

5.syms
          This is used to initialize a variable or variables as a symbol or symbols.

           syms x y indicates x and y are initialized as symbols or variables.

6.whos
           Executing this shows all the variables used,the space allocated to them,the class.If you wanna clear a variable name so type clear x if you wanna clear x.if u wanna clear two variables x and y execute clear x y.
If you wanna clear all type clear all
          

PLEASE LEAVE A COMMENT :)

0 comments:

Post a Comment