
Declaration of Variables in MATLAB

Declaration of Variables in MATLAB
Here, in the tutorial Declaration of variables in MATLAB, I will show you that how the variables can be declared in the MATLAB and how to manipulate them without assigning them with the values. The command syms is used to declare the different variables in the MATLAB.- Here, I will show you that what happens if you have not declared the variables.
- The error is shown in the figure below, when you have not declared the variables.
- I have written an equation having three different variables named as f,t and r without declaring these variables.
- MATLAB has shown an error on the command window as undefined function or variable.
- So the error shown in the above figure shows the desired results can not be obtained without declaring the variables first.
- Now, I am going to declare all the variables first and will then manipulate them.
- The declared variables are shown in the figure below.
- Since I have declared all of the variables now which are being used in the equation.
- So, now I am going to manipulate them and going to observe the results.
- The result of the addition of the two variables, which is stored in the third variable, is shown in the figure below.
- The above figure shows the result of the addition of the two different variables in the form of an equation.
- The result has been obtained because all of the variables has been declared first, i.e. declaration of variables plays a very important role while writing an algorithm to perform any task either simple or complicated.
- You can also see all of the process in the video given below:
×
![]()








