Initialize variables

Initialize matrix with ones




Initialize diagonal matrix


Initialize with zeros


Initialize with random values:

Initialize with specific value a vector or column:

Initialize with ranges

Initialize with range and steps

Useful commands: ones(m,n), zeros(m,n), repmat(Value, m, n), eye(m,n), rand(m,n), randi(MAX value, m,n)



Plotting linear equations

Let's say we want to plot this equation: y = 3x



Plotting quadratic equations

Image you want to plot the following equation: y = 5*x+3x^2+1. It's roots are:

roots = (-b +- squareroot(-b^2+4*a*C))/2*a => x1 = -0.232, x2 = -1.434