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
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
ADVERTISEMENT