0
0
MATLABdata~10 mins

MATLAB vs Python vs R comparison - Interactive Practice

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

Complete the code to create a vector of numbers from 1 to 5 in MATLAB.

MATLAB
vec = [1];
Drag options to blanks, or click blank then click option'
A[1 5]
B1:5
Crange(1,5)
Dseq(1,5)
Attempts:
3 left
💡 Hint
Common Mistakes
Using Python or R syntax like range() or seq() instead of MATLAB colon operator.
2fill in blank
medium

Complete the Python code to create a list of numbers from 1 to 5.

MATLAB
lst = list(range(1, [1]))
Drag options to blanks, or click blank then click option'
A1,6
B5
C1,5
D6
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing range parameters or using R or MATLAB syntax.
3fill in blank
hard

Fix the error in this R code to create a sequence from 1 to 5.

MATLAB
seq_vec <- [1](1, 5)
Drag options to blanks, or click blank then click option'
Aseq
Brange
Clist
Dvector
Attempts:
3 left
💡 Hint
Common Mistakes
Using range instead of seq in R.
4fill in blank
hard

Fill both blanks to create a 3x3 identity matrix in MATLAB and Python.

MATLAB
mat_matlab = [1](3);
mat_python = np.[2](3)
Drag options to blanks, or click blank then click option'
Aeye
Bidentity
Cones
Dzeros
Attempts:
3 left
💡 Hint
Common Mistakes
Using ones or zeros instead of identity matrix functions.
5fill in blank
hard

Fill all three blanks to calculate the mean of a vector in MATLAB, Python, and R.

MATLAB
mean_matlab = [1](vec);
mean_python = statistics.[2](vec)
mean_r <- [3](vec)
Drag options to blanks, or click blank then click option'
Amean
Dmedian
Attempts:
3 left
💡 Hint
Common Mistakes
Using median instead of mean.