English-Tutorial-4: Special Function in MATLAB-2013a

Special Function in MATLAB-2013a

 

When we input something like anything which already stored their memory and we get output something from that, it’s called function.

There are two types of function:

  1. Built in function
  2. Manual function

 

Built in function:

Built in function is a function which is provide by MATLAB. MATLAB has some built in function and you need to use that without any customization.

 

Manual function:

You can make/ create a function and use that. So your won function is actually manual function. You can change manual function anytime without any permission.

MATLAB has some important built in function. By using that’s function you can do much more. See that’s functions are below:

“”clc, clear all, accumarray, blkdiag, diag, eye, false, freqspace, linspace, logspace, meshgrid, ndgrid, ones, rand, true, zeros, cat, horzcat, vertcat””

If you can find any function help by the command window, just write “help ‘function name’”. Let’s mind you don’t know about ‘linspace’ function. Go to command window and just type help space your function name.

Example below:

help linspace

 linspace

 

 

You can use now every function for see what’s it by the command window of MATLAB. I will show you now some of important function. If you very interested with matlab so please http://www.mathworks.com for more learning.  Let’s go for see some functions work’s on MATLAB command window.

  1. clc (clear screen):

clc function are using for clearing command window. That mean when you use clc function your command window will be clear. So let’s for see. Open you command window, now type some random code anything, now type clc and press enter. You will see your command windows screen is. Please use this function with yourself.

  1. clear all:

When you use clear all function, all of variable and others cache of MATLAB will be clear. That mean it’s do refresh your works place.

  1. linspace:

linspace is the most important function for MATLAB. For create solve many plot and application you may need to use this function.

What is linspace: linspace is a constant vector space. It’s create manually 100 same row space from X1…X2. Each row will have each value.

Let’s go for see example:

On the command window type x = linspace(0,pi) and press enter. You can see a output the same of below.

>> x = linspace(0,pi)

x =

  Columns 1 through 9

         0    0.0317    0.0635    0.0952    0.1269    0.1587    0.1904    0.2221    0.2539

  Columns 10 through 18

    0.2856    0.3173    0.3491    0.3808    0.4125    0.4443    0.4760    0.5077    0.5395

  Columns 19 through 27

    0.5712    0.6029    0.6347    0.6664    0.6981    0.7299    0.7616    0.7933    0.8251

  Columns 28 through 36

    0.8568    0.8885    0.9203    0.9520    0.9837    1.0155    1.0472    1.0789    1.1107

  Columns 37 through 45

    1.1424    1.1741    1.2059    1.2376    1.2693    1.3011    1.3328    1.3645    1.3963

  Columns 46 through 54

    1.4280    1.4597    1.4915    1.5232    1.5549    1.5867    1.6184    1.6501    1.6819

  Columns 55 through 63

    1.7136    1.7453    1.7771    1.8088    1.8405    1.8723    1.9040    1.9357    1.9675

  Columns 64 through 72

    1.9992    2.0309    2.0627    2.0944    2.1261    2.1579    2.1896    2.2213    2.2531

  Columns 73 through 81

    2.2848    2.3165    2.3483    2.3800    2.4117    2.4435    2.4752    2.5069    2.5387

  Columns 82 through 90

    2.5704    2.6021    2.6339    2.6656    2.6973    2.7291    2.7608    2.7925    2.8243

  Columns 91 through 99

    2.8560    2.8877    2.9195    2.9512    2.9829    3.0147    3.0464    3.0781    3.1099

  Column 100

    3.1416

>> 

Here x is a variable and I have stored linspace(0,pi) on this variable. Now we know in mathematical terms pi = 3.1416, also we know linspace will create 100 constant space with your value. That mean the output result will be show 100 constant space, generate 100 value from 0-3.1416 and  each value are will be stored in every space. For use others function please go http://www.mathworks.com for help.

Comment below for help.

Write Your Comments

comments

Leave a Reply