Question: Do the following in MATLAB code: Given a matrix A=rand(100,100), write a few lines of code to do each of the following. Avoid using loops!!!!!

Do the following in MATLAB code:

Given a matrix A=rand(100,100), write a few lines of code to do each of the following. Avoid using loops!!!!!

  1. Sort all the elements in A, put the result in a single 10,000-dimensional vector x, and plot the values in x.
  2. Create a 64-bin histogram bar chart of the elements in A. Use hist();
  3. Create a new matrix with the same size as A, which is 255 wherever the element in A is greater than a threshold t (e.g., 0.5), and 0 everywhere else; call imagesc() to visualize this matrix as an grayscale image;
  4. Create a matrix to store the elements in the bottom right quadrant of A.
  5. Create a new matrix that is a duplicate of A; Subtract As mean value from every element of B; Set any negative element in B to be 0.
  6. Create a new matrix to include all rows of A whose first column is larger than 0.5 and second column is smaller than 0.8.
  7. Create a new matrix by randomly selecting 20 rows from A.

Thank you!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!