Matlab basic example
1. Defining a row matrix and performing operations on it Assume that you want to evaluate the function f(x) = x^3-6x^2 + 3 at different values of x. This can be accomplished with two lines of MATLAB code. % Define the values of x x = 0:0.01:1; % Evaluate f f = x .^ 3 - 6 * x .^ 2 + 3; In this example, x varies between 0 and 1 in steps of 0.01. Comments are preceded by a % sign. The symbols ˆ and * stand for the power and multiplication operators respectively. The dot in front of ˆ n indicates that each entry of the row matrix x is raised to the power n. In the absence of this dot, MATLAB would try to take the nth power of x, and an error message would be produced since x is not a square matrix. A semicolon at the end of a command line indicates that the output should not be printed on the screen.