Saturday, 29 August 2015

INTRO TO VARIABLES IN MATLAB

A Variable is a object that contains a specific value.A variable can be initialized using an "=" operator (assignment operater)
Command:
          a= 10        
       
          % for assigning a integer to a variable

 note: " % " is used to represent comment .The line starting with " % " symbol is skipped from execution output is shown below
  integer

Same syntax applies for decimals
command:
           b= 0.01
the output is


  decimal for

substituting the value in a function
command
c = sin(a)
the output is

  fn

This is how the variables are used in MATLAB

note: as you noticed we didn't put any semicolon after the command as it is popularly used in many programming languages,This is because if we use semicolon it will execute the command but the result is not displayed.

Screenshot (9)

clc command:

"clc " command is used to clear the screen.it is very important command as it is useful everytime

No comments:

Post a Comment