0
0
MATLABdata~10 mins

Why numerical computation solves real problems in MATLAB - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to calculate the square root of 16.

MATLAB
result = sqrt([1]);
Drag options to blanks, or click blank then click option'
A4
B16
C8
D25
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong number inside sqrt, like 25 or 8.
2fill in blank
medium

Complete the code to create a vector from 1 to 5.

MATLAB
vec = [1];
Drag options to blanks, or click blank then click option'
A1:10
Blinspace(1,10,5)
C[5 4 3 2 1]
D1:5
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1:10 creates a longer vector than needed.
3fill in blank
hard

Fix the error in the code to compute the sum of elements in vector v.

MATLAB
total = [1](v);
Drag options to blanks, or click blank then click option'
Asum
Badd
Cplus
Dtotal
Attempts:
3 left
💡 Hint
Common Mistakes
Using add or plus which are not functions for summing vectors.
4fill in blank
hard

Fill both blanks to create a vector of squares of numbers 1 to 5.

MATLAB
squares = ([1]:[2]).^2;
Drag options to blanks, or click blank then click option'
A1
B2
C5
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong start or end values like 2 or 10.
5fill in blank
hard

Fill all three blanks to create a vector of even numbers from 2 to 10.

MATLAB
evens = [1]:[2]:[3];
Drag options to blanks, or click blank then click option'
A1
B2
C10
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using step 1 instead of 2, or wrong start/end values.