Question

MATLAB programming

MATLAB programming

media%2Ffc9%2Ffc9fd5dc-dfbd-4517-af0c-60
0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE:

A = [1 3 2; 4 17 5; 6 1 6];
%cacluclating total
B = sum(A);
%appending the total in the original 2d array
C = [A;B];
fprintf('After appedning:\n');
disp(C);

%finding max total value and its column
[m, n] = size(C);
max = -1;
maxInd = 0;
for i = 1:n
if max < C(4, i)
max = C(4, i);
maxInd = i;
end
end
fprintf('Maximum total = %d, column = %d\n', max, maxInd);

%finding min total value and its column
min = 9999999;
maxInd = 0;
for i = 1:n
if min > C(4, i)
min = C(4, i);
minInd = i;
end
end
fprintf('Minimum total = %d, column = %d\n', min, minInd);

%finding the number of elements that are greater than the average of total
avg = mean(B);
count = 0;
[m, n] = size(A);

for i = 1:m
for j = 1:n
if A(i, j) > avg
count = count + 1;
end
end
end
fprintf('Number of elements greater than the average total is: %d\n', count);

OUTPUT:

Command Window >>untitled After appedning 1 2 4 17 6 1 13 11 21 Maximum total 21, column 2 Minimum total = 1 11, column Numbe

PLEASE MAKE SURE TO LIKE THE ANSWER. THANKS SO MUCH IN ADVANCE :)

Add a comment
Know the answer?
Add Answer to:
MATLAB programming
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
  • Matlab Help How to go over this integration by using loop of matlab programming, Given A...

    Matlab Help How to go over this integration by using loop of matlab programming, Given A 2, a 0.5, c 0.6, g 9.8 h1- 2, h1- 1, t1-0, t2 0 dh Q A EQ(2) dt Substitute EQ(1) to EQ (2) dh dt h2 t2 dh t 1

  • NOTE: IN THIS MATLAB PROGRAMMING EXERCISE, WRITE THE PROGRAM FIRST BY HAND, ON PAPER. THEN KEY...

    NOTE: IN THIS MATLAB PROGRAMMING EXERCISE, WRITE THE PROGRAM FIRST BY HAND, ON PAPER. THEN KEY YOUR PROGRAM INTO MATLAB, AND RUN IT TO PRODUCE OUTPUT. "WORK" FOR THIS EXERCISE WILL CONSIST OF YOUR HANDWRITTEN PROGRAM AND A SCREENSHOT OF YOUR PROGRAM IN MATLAB AS WELL AS THE OUTPUT YOUR PROGRAM PRODUCES MATLAB PROGRAMMING EXERCISE 8 (From physical chemistry; 4 pts.) Using the Redlich-Kwong equation of state for a real gas, we can calculate the work produced by that gas...

  • for matlab programming beginner level Q3) We are given a Turkish word. Check if it is...

    for matlab programming beginner level Q3) We are given a Turkish word. Check if it is the same when the word is reversely read. Example: "neden". When it is reversed, it is the same. Example: "sanat". When it is reversed, it is: "tanas" and not the same.

  • These programming languages are supported in Visual Studio without extension __________________________ Java, Wolfram, Matlab C#, Visual...

    These programming languages are supported in Visual Studio without extension __________________________ Java, Wolfram, Matlab C#, Visual Basic, F# Node.js, jQuery, Ruby Fortran, COBOL, Perl

  • Exercise 3 -This small programming exercise is on algorithms and thir implementation with MATLAB. You are...

    Exercise 3 -This small programming exercise is on algorithms and thir implementation with MATLAB. You are to program in MATLAB a simple echo effect algorithm that uses the FIR configuration You must design an FIR filter such that an audio echo effect (Fig. 1) is produced. simple audio synthesis and audio effects Delay Original Sound First Echo Second Echo Fig. 1. Synthetic demo of Echo effect. Design an echo effect filter using the FIR configuration. Design an FIR with two...

  • MATLAB Programming Question Using MATLAB, complete the following problem: 1. For the solid cylind...

    MATLAB Programming Question Using MATLAB, complete the following problem: 1. For the solid cylinder and loading shown, find the d, maximum shearing stress. Describe your solution process and keep your answer in symbolic form. Develop a MATLAB program to support a discussion describing how the maximum shearing stress is affected by a change in the applied torsion and the cylinder diameter. Feel free to use this MATLAB script shell as a starting point or develop your own. dt 2. Using...

  • MATLAB Programming Question Create an M-file (script) that prompts the user to enter a value of...

    MATLAB Programming Question Create an M-file (script) that prompts the user to enter a value of x and then calculates the value of sin (x). This is my script: x=input('enter value of x in radians'); y=sin(x); And I get the error message, Warning: Function sin has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. How would I fix this?

  • Please use MATLAB programming as this is what we use for class thank you. 39. The...

    Please use MATLAB programming as this is what we use for class thank you. 39. The following MATLAB commands create a sine-sha ped signal y(t) that contains random noise: t = 0: .05:10; y sin (t)-0.1+0.2 rand (1,length (t)) Write a MATLAB program that uses these commands to create a noisy sine-shaped signal. Then the program smooths the signal by using the three- points moving-average method. In this method the value of every point i except the first and last,...

  • Please answer with Matlab Programming that can be copied and pasted when doing the Matlab part...

    Please answer with Matlab Programming that can be copied and pasted when doing the Matlab part 4 part 2 4. Please finish the following Matlab code for solving the ODE: dy 2(1+t) dt I.C. y(0) = 0 with the multi-step 4th order Milne's Method, and apply 4th order Runge Kutta method to the first 4 points (1 boundary point and the next 3 points). (Hint: 4th order Milne's Method Predictor: Jon = Y-3 + H25,- fia+2f1-2) h Corrector: Y:-1 =...

  • solve part B Note: Do not use MATLAB (or other programming languages) build-in functions for regression....

    solve part B Note: Do not use MATLAB (or other programming languages) build-in functions for regression. (a) Write a MATLAB (or other programming languages) function that accepts n values of xi and Yi, perform Linear Regression and returns values of rand, the model parameters ao and a. (6) Write another MATLAB (or other programming languages) function that accepts n values of X, and y(provided as arrays), checks for Linear, Power (y = axBx) and Saturation growth- rate (y = a*)...

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