Question

MATLAB QUESTION !!! PLEASE USE MATLAB FOR BOTH QUESTIONS!!! THANKS

3) Below is a matrix of random numbers. Find the mean, median, and mode of the matrix. B=[0 1 2 3 4 50689 23092 6 8 407] Sort

0 0
Add a comment Improve this question Transcribed image text
Answer #1

B=[0 1 2 3 4;5 0 6 8 9;2 3 0 9 2;6 8 4 0 7];
mean_B=mean(mean(B));
median_B=median(median(B));
B=[flip(sort(B(1,:)));flip(sort(B(2,:)));flip(sort(B(3,:)));flip(sort(B(1,:)))];
fprintf("Mean of matrix B is: %f\n",mean_B);
fprintf("Meadian of matrix B is: %f\n",median_B);
disp("Sorted matrix is:\n");
disp(B);

C:\Octave\OCTAVE-1.0\mingw64\bin\octave-gui.exe octave:43> B=[0 1 2 3 4;5 0 6 8 9;2 3 0 9 2;6 8 4 0 7]; octave:44> mean_B=mea

Please find the attached code..

clc;
clear all;
X = [0:1:50; 50:1:100];    % Here, 1 is interval (You can change it as per your needs)
Y = X.^10;
Z = X.*(Y.^2);
subplot(2,2,1);
mesh(X,Y,Z);
xlabel('X');
ylabel('Y');
zlabel('Z');
title('Mesh plot');
subplot(2,2,2);
surf(X,Y,Z);
xlabel('X');
ylabel('Y');
zlabel('Z');
title('Surface plot');
subplot(2,2,3);
plot3(X,Y,Z);
xlabel('X');
ylabel('Y');
zlabel('Z');
title('3-Dimentional plot');
subplot(2,2,4);
surfc(X,Y,Z);
xlabel('X');
ylabel('Y');
zlabel('Z');
title('Surface-Contour plot');
grid on;

The subplot command will create a figure grid for plots. Eg. subplot(i,j,k), it will create a figure grid with i rows and j columns (i*j number of figures), and 'k' is a figure number.

The output will look like..

Mesh plot Surface plot *1041 x 1041 10 10 N 5 N 5 10 10 100 100 1019 *1019 50 5 50 Y 0 0 X 3-Dimentional plot 5 Y 0 0 X Surfa

Add a comment
Know the answer?
Add Answer to:
MATLAB QUESTION !!! PLEASE USE MATLAB FOR BOTH QUESTIONS!!! THANKS 3) Below is a matrix of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • How do I solve using Matlab? Create a matrix X so that the first row has...

    How do I solve using Matlab? Create a matrix X so that the first row has values from 0 to 50 (default intervals), and the second row has values from 50 to 100. Let matrix Y equal to x10 and Z equal to x + y2 Create 4 subplots containing a mesh, surface, 3-Dimensional, and a surface-contour plot. Label with appropriate titles and labels. The plots should have a string look to them.

  • How do I solve using Matlab? Below is a matrix of random numbers. Find the mean,...

    How do I solve using Matlab? Below is a matrix of random numbers. Find the mean, median, and mode of the matrix. B=[0 1 2 3 4 50 689 23092 68 40 7] Sort Matrix Z so that the largest numbers of each row are in the first column and smallest numbers descend towards the last column. Must use sort function.

  • what is a good matlab code to out put this matrix from question 1 to 3...

    what is a good matlab code to out put this matrix from question 1 to 3 HITA 1)-The general form cf the quadratic equation is a +bx+c 0 Wrte a MATLAB function named quadratic that finds the two roots of this equation and x when given the coeficients a, b and c 2)-Create a random matrix A in MATLAB with 6 rows and 3 oolumns using the rand) function 3)-Now modify quadratic by so that il can take each row...

  • cope the code please thanks Write a MATLAB code to obtain the following. Keep your code...

    cope the code please thanks Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your source code and command widow outcomes and screen shots of any plots in your solution. Generate a matrix "A" as follow. A= 16 6 8 2 10 18 12 14 4 I. II. Divide the matrix A by 2 and store the result in a matrix B. Combine matrices A & B to obtain the following matrix C. Also...

  • PLEASE USE MATLAB Create a single MatLab script that On a single line (Line 1), defines...

    PLEASE USE MATLAB Create a single MatLab script that On a single line (Line 1), defines matrix A such that A = 1 2 4. 5 7 8 Suppress the echo of A. On a single line (Line 2), use the size function to echo the size of A. On a single line (Line 3), use the length function to echo the length of the entire first row of A. On a single line (Line 4), use linear index notation...

  • In Matlab A= 3 -5 6 ( 15 7 9 13 5 -4 12 10 2...

    In Matlab A= 3 -5 6 ( 15 7 9 13 5 -4 12 10 2 8 11 4 1 For the matrix A in problem-2, use MATLAB to carry out the following instructions a. Find the maximum and minimum values in each column. b. Find the maximum and minimum values in each row. c. Sort each column in ascending order and store the result in an array P. d. Sort each row in descending order and store the result...

  • What would be the code in Matlab for the following: a) Generate a 4x5 matrix of...

    What would be the code in Matlab for the following: a) Generate a 4x5 matrix of random integers, each in the inclusive range from -35 to 55. Then delete the second and third columns. b) Generate a 6x4 matrix of random real numbers, each in the range (-20,60). Then replace the first row with 1:4, and replace the last column (you decide with which values).

  • The question is attached in following two photos. Please use Matlab if you exactly know how to do it. Thank you. Linorm.m Create a function Linorm which takes one argument, M a square matrix and...

    The question is attached in following two photos. Please use Matlab if you exactly know how to do it. Thank you. Linorm.m Create a function Linorm which takes one argument, M a square matrix and computes the LI-norm of the matrix. This is a number associated to each square matrix M, denoted lIMll, as follows. For each column of the matrix we add together the absolute values of the entries in that column, and we then take the maximum of...

  • please provide the matlab working screenshot 4. Consider the matrix 1 1 0 -1 0 -1 1 3 12 1 1 (a) Use Matlab to determin...

    please provide the matlab working screenshot 4. Consider the matrix 1 1 0 -1 0 -1 1 3 12 1 1 (a) Use Matlab to determine the reduced row echelon form of A. (b) If v, v2, vs, v4 are the column vectors of the matrix A, use your result from (a) to obtain a basis for the subspace of W-lin[vi, V2, vs, v4. Write the basis in the box below. 4. Consider the matrix 1 1 0 -1 0...

  • Create a matrix with 3 rows and 4 columns. Every element in the first row should...

    Create a matrix with 3 rows and 4 columns. Every element in the first row should be 0, every element in the second row should be 1, and every element in the third row should be 2. But don’t just type out all the numbers. Use some ingenuity. Display the matrix using MATLAB.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT