Lab Tutorial
Lab Tutorial
Objective: To familiarise students with the MATLAB interface, basic operations, commands,
and mathematical computations.
Type exit or quit in the Command Window, or click the close button.
Row vector:
>> v = [1 2 3 4];
Column vector:
>> v = [1; 2; 3; 4];
Using the colon operator:
>> v = 1:5;
Example:
>> A = [1 2 3; 4 5 6; 7 8 9];
Access elements:
>> A(2,3); % Element in 2nd row, 3rd column
4. Numerical Operations
Examples:
>> round(53/7);
>> floor(53/7);
5. Managing Variables
6. Symbolic Operations
Example:
>> syms x y;
>> z = x^2 + y^2;
Use simplify:
>> simplify((x^3 - y^3)/(x-y));
Conclusion: This lab introduces MATLAB’s basic interface and computational capabilities.
Practice the examples above to build a strong foundation for more advanced topics.