Answered step by step
Verified Expert Solution
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!!!!!
- Sort all the elements in A, put the result in a single 10,000-dimensional vector x, and plot the values in x.
- Create a 64-bin histogram bar chart of the elements in A. Use hist();
- 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;
- Create a matrix to store the elements in the bottom right quadrant of A.
- 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.
- 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.
- 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started