Complete the code to calculate the square root of 16.
result = sqrt([1]);The sqrt function calculates the square root of the input number. Here, the square root of 16 is 4.
Complete the code to create a vector from 1 to 5.
vec = [1];The colon operator 1:5 creates a vector with values from 1 to 5.
Fix the error in the code to compute the sum of elements in vector v.
total = [1](v);add or plus which are not functions for summing vectors.The sum function adds all elements of the vector v.
Fill both blanks to create a vector of squares of numbers 1 to 5.
squares = ([1]:[2]).^2;
The colon operator 1:5 creates numbers from 1 to 5. Squaring each gives the squares vector.
Fill all three blanks to create a vector of even numbers from 2 to 10.
evens = [1]:[2]:[3];
The syntax start:step:end creates a vector starting at 2, stepping by 2, up to 10, giving even numbers.
