Complete the code to add two numbers and store the result in sum.
a = 5; b = 3; sum = a [1] b;
* instead of addition./ instead of addition.The plus sign + adds two numbers in MATLAB.
Complete the code to multiply two numbers and store the result in product.
x = 7; y = 4; product = x [1] y;
+ instead of multiplication./ instead of multiplication.The asterisk * multiplies two numbers in MATLAB.
Fix the error in the code to correctly divide num1 by num2.
num1 = 10; num2 = 2; result = num1 [1] num2;
* instead of division.- instead of division.The forward slash / divides one number by another in MATLAB.
Fill both blanks to calculate the remainder when a is divided by b.
a = 17; b = 5; remainder = mod([1], [2]);
The mod function returns the remainder of division. Use the variables a and b as inputs.
Fill both blanks to create a vector of squares of numbers from 1 to 5.
numbers = 1:5; squares = numbers [1] [2];
^ instead of .^ which causes an error for vectors.* instead of power operator.In MATLAB, .^ is the element-wise power operator. To square each element, use .^ 2. The multiplication operator * is not used here.
