LavezLas
Newbie level 5

Hi fellas,
I'm not familiar with MATLAB, and this year in our Introduction to DSP class, teacher gave us a homework but nearly none of us knows MATLAB much...
His question is;
Create an array with randomly-selected 1000 elements between -50 and 50. Compare
each element of the array such that;
If the element is greater than 30; change it as 30.
If the element is less than -30; change it as -30.
If the element is between -30 and 30; the element keeps its value.
Write the corresponding code for the question.
I'm not familiar with MATLAB, and this year in our Introduction to DSP class, teacher gave us a homework but nearly none of us knows MATLAB much...
His question is;
Create an array with randomly-selected 1000 elements between -50 and 50. Compare
each element of the array such that;
If the element is greater than 30; change it as 30.
If the element is less than -30; change it as -30.
If the element is between -30 and 30; the element keeps its value.
Write the corresponding code for the question.