Complete the code to create a script file that assigns 10 to variable x.
x = [1];The script assigns the number 10 to variable x. Numbers are written without quotes.
Complete the code to display the value of variable y in the script.
y = 5; disp([1]);
The disp function shows the value of variable y. Use the variable name without quotes.
Fix the error in the script to correctly calculate the square of z.
z = 4; square = z[1]2;
In MATLAB, the caret ^ is used for exponentiation to square a number.
Fill both blanks to create a script that calculates the area of a circle with radius r.
r = 3; area = [1] * r[2] 2;
The area of a circle is pi * r^2. Use pi for π and ^ for power.
Fill all three blanks to create a script that calculates the average of three numbers a, b, and c.
a = 4; b = 5; c = 6; avg = ([1] + [2] + [3]) / 3;
The average is the sum of a, b, and c divided by 3. Use the variable names inside the parentheses.