Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a simple signal vector.
MATLAB
signal = [1, 2, 3, 4, [1]];
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a number that breaks the sequence.
✗ Incorrect
The signal vector ends with 5 to complete the sequence.
2fill in blank
mediumComplete the code to calculate the mean of the signal.
MATLAB
average = mean([1]);Attempts:
3 left
💡 Hint
Common Mistakes
Using undefined variables like 'data' or 'input'.
✗ Incorrect
The variable 'signal' holds the data to find the mean.
3fill in blank
hardFix the error in the code to plot the signal correctly.
MATLAB
plot([1]);Attempts:
3 left
💡 Hint
Common Mistakes
Plotting undefined variables like 'data' or 'x'.
✗ Incorrect
The 'plot' function needs the signal vector to display the data.
4fill in blank
hardFill both blanks to create a filtered signal using a moving average.
MATLAB
filtered_signal = movmean([1], [2]);
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names or window sizes.
✗ Incorrect
Use 'signal' as input and window size 3 for the moving average.
5fill in blank
hardFill all three blanks to compute and plot the frequency spectrum of the signal.
MATLAB
Y = fft([1]); N = length([2]); f = (0:N-1)*([3]/N); plot(f, abs(Y));
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variables or wrong sampling frequency.
✗ Incorrect
Use 'signal' for FFT and length, and 1 as sampling frequency.
