A Variable is a object that contains a specific value.A variable can be initialized using an "=" operator (assignment operater)
% 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
Same syntax applies for decimals
the output is
for
substituting the value in a function
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.
clc command:
"clc " command is used to clear the screen.it is very important command as it is useful everytime
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
Same syntax applies for decimals
command:b= 0.01
the output is
for
substituting the value in a function
command:
c = sin(a)the output is
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.
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