Complete the code to create an anonymous function that squares its input.
square = [1] x^2;
The @(x) syntax defines an anonymous function in MATLAB that takes x as input.
Complete the code to create an anonymous function that adds 5 to its input.
addFive = [1] x + 5;
Anonymous functions in MATLAB start with @(x) followed by the expression.
Fix the error in the anonymous function that multiplies input by 3.
triple = [1] x * 3;
The correct way to define an anonymous function in MATLAB is with @(x).
Fill both blanks to create an anonymous function that returns true if input is greater than 10.
isGreaterThanTen = [1] x [2] 10;
The anonymous function starts with @(x) and uses the greater than operator > to compare.
Fill all three blanks to create an anonymous function that returns true if input is between 5 and 15 (inclusive).
isBetween = [1] x [2] 5 && x [3] 15;
The function uses @(x) to define the anonymous function, and checks if x is greater than or equal to 5 and less than or equal to 15.