The following exercises are meant to be answered by few lines of MATLAB code; mo
ID: 3804615 • Letter: T
Question
The following exercises are meant to be answered by few lines of MATLAB code; most of them could be expressed in a single line of code or command. The command may be involved (i.e., it may use a number of parentheses or calls to functions) but can, in essence, be solved by the execution of a single command. If the problem is too complicated, feel free to break it up over two or more lines and later to collapse it into a single line.
7. Matrix operations:
a. Create a random 3x4 matrix A of numbers in the range 10 to 50:
s=10;
f=50;
rand('seed',123965);
A=reshape((f-s)*rand(1,12)+s,3,4);
Explanation / Answer
code:
a =-10
b =50
r = (b-a).*rand(12,1) + a
reshape(r,[3,4])
logic:first creat an array that will contains random value between -10 to 50 and then reshape into the 3*4 matrix
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.