Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions