Matlab: Programming Environment

  • 1,139 views
Uploaded on

Matlab: Programming Environment

Matlab: Programming Environment

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,139
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Matlab: Programming Environment
  • 2. Your first run
    Section 1: The toolbar is where you can access the various features, tools and options regarding your code, debugging process, formatting, etc
  • 3. Your first run
    Section 2: The file-manager shows your current directory and the files in it. You can change the directory by double clicking any folder or using the drop-down menu at the top.
  • 4. Your first run
    Section 3: The command window is the place from where you tell MATLAB what is to be done! You have the option of either writing commands directly or running a 'MATLAB' file (with the extension .m) which would consist of commands, functions or programs.
  • 5. Your first run
    Section 4: When you write a new program or type in some commands, you would almost always, use variables to store the values obtained. The workspace shows you all your current variables and their values and allows you to edit, copy or duplicate them.
  • 6. Your first run
    Section 5: The command history window saves your recent commands and helps you in keeping a track of what you have been up to!
    It comes out quite handy when you have to use long commands repeatedly: Simply double click on that command in the command history window and it will start running!
  • 7. MATLAB Help
    MATLAB provides an excellent documentation of all its toolboxes and their respective commands. It also includes sample codes and examples! Go to the Help option and MATLAB and click on 'Product Help'(or simply press F1).
  • 8. MATLAB Help
    Explore the Help contents and you would find loads of useful things. Here is a snapshot of the first example in Image Processing toolbox. It teaches how to read and display an image.
  • 9. Function Browser: a quick search tool!
    Click on 'Help' on the toolbar and go to 'Function Browser' (or press Shift+F1). This is what will pop up:
  • 10. Function Browser: a quick search tool!
    The 'Function Browser', as the name suggests, is a quick search tool for description and synopsis of commands and functions of MATLAB. In the figure towards the right, I have searched for 'contrast' and it lists all the functions and commands related to that keyword. It gives concise information about the function you are looking for.
  • 11. Basic Functions
    Matlab allows us to define (and evaluate) our own functions as well. For example, lets define a function f(x)=x2+1. To do this, we simply type in f=x.^2+1. Since x has a value of 10, the answer is 101. We can now change the value of x. For example, type x=5 and enter, then type f=x.^2+1 again. We should now get 26.
  • 12. Basic Functions
    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:
    >> v = [3 1]
    v = 3 1
  • 13. Basic Functions
    To view the vector just type its label:
    >> v
    v = 3 1
    >> v = [3 1 7 -21 5 6]
    v = 3 1 7 -21 5 6
  • 14. Basic Functions
    To define a matrix, we 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
  • 15. Basic Functions
     the whoscommand will let you know all of the variables you have in your work space.
    >> whos
    Name Size Bytes Class
    A 3x3 72 double array
    B 3x3 72 double array
    v 1x5 40 double array
    Grand total is 23 elements using 184 bytes
  • 16. Basic Functions
     Sometimes you would like to clear all of your data and start over. You do this with the "clear" command.
    >> clear
    >> whos
  • 17. Visit more self help tutorials
    Pick a tutorial of your choice and browse through it at your own pace.
    The tutorials section is free, self-guiding and will not involve any additional support.
    Visit us at www.dataminingtools.net