Question

1) Write a script that prompts the user to enter a value n (n 6) that will generate an n element vector of random integers between 0 and 100 that will represent quiz grades. Then have the script calculate the average ofthe quizzes where the smallest grade is dropped. Then script will display the average of the quizzes along with the highest quiz grade. 2) Given the following system of equations: 8s 11t 7u 5v w 2x 3y 4z 115 3s 8t 4u 9v 2w 9x y z 200 3t 6u -13w 2x 5z 38 w 14x y z 20 19s 6t -w 3y 75 -12s 5t 3u 17v-5w 7z 44 23u 15v 7w 14y z 108 2s 3 -4w 5y 40 Solve these equations using both left division, right division, and multiplying matrices using the inverse of a matrix by using both the inverse function and raising the matrix to the -1 power. 3) Use MATLAB to show that the sum of the infinite series converges to In2. Do (2n +1)2n 2) this for computing the sum for a) n 50 b) n- 500 c) 5000 For each case compute the percent error using the equation: Exact Value Approximate Value Percent error X 100% Exact Value Hint: You need to create a vector n ranging between 0 and 50, 500 and 5000, then use element by element calculations, and a built-in function to the get the approximations.

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

1)% for quiz grades.

clear all;
clc

prompt = 'enter n value ';
n = input(prompt);
quiz_grades = randi([0,100],1,n)    %random value of number b/w 0 -100
minimum = min(quiz_grades);         % finding minimum of values

average = mean(quiz_grades(quiz_grades~=minimum))       %finding mean value leaving minimum value
maximum = max(quiz_grades)             %finding maximum value
   

enter n value 5 quiz_grades 76 27 68 66 16 average 59.2500 maximum 76

%2) to find left right division

A = [8,-11,7,5,-1,2,3,4;
    3,-8,4,-9,2,9,1,-1;
    0,3,-6,0,-13,-2,0,-5;
    0,0,0,0,1,14,1,1;
    19,-6,0,0,-1,0,3,0;
    -12,-5,-3,17,-5,0,0,7;
    0,0,23,-15,7,0,14,1;
    2,-3,0,0,-4,0,5,0]
B = [115; 20;-38;-20; 75; 44; 108; 40]
left= A\B
linv = inv(A)*B          %left inverse
lraised = A^-1 *B      %raised to power -1
right = B/A
rinv = A*inv(B)
rraised = A *B^-1

3.0000 1.0000 -1, 0000 -2.0000 4.0000 5.0000 2.0000 -4.0000 3.0000 1.0000 -1, 0000 -2.0000 4.0000 5.0000 2.0000 -4.0000

%3) to find the summation of infinite series

clear all;
clc

prompt = 'enter n value ';
n = input(prompt);

L =log(2)

for i=1:n
    P =(1/((2*n+1)*(2*n+2)));
   
end

S= sum(P)

per_err = ((L - S)/L)*100

enter n value 50 0.6931 9.7069e-005 pererr = - 99.9860

enter n value 500 0.6931 9.9701e-007 pererr = - 99.9999 fx >>

enter n value 5000 0.6931 9.9970e-009 pererr = - 100.0000

Add a comment
Know the answer?
Add Answer to:
Write a script that prompts the user to enter a value n (n > 6) that...
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 QUESTION!!! 9) The following system of equations is used in Navier Stokes theorem to determine...

    MATLAB QUESTION!!! 9) The following system of equations is used in Navier Stokes theorem to determine force fluctuations on a hypersonic jet. Solve the following system of equations using inverse matrix method and left division. Show how long this process takes to compute using Matlab. 3x+y+z+w+3v=27 5v-3y+x+7z+w=17 2x+2y-3z+4w-v=16 x+y+z+w+y=1 y-z+x-w-7v=-7

  • 1.1) Write a script in MATLAB that uses Reimann sum with 100 intervals (n=100) to calculate...

    1.1) Write a script in MATLAB that uses Reimann sum with 100 intervals (n=100) to calculate hydrostatic force of water on a triangular gate submerged under water (Figure 1). Give two estimates of this force (lower and upper bound for value of force). Hint: You may need to first find the hydrostatic force on the thin hashed slice by hand using the following information. Hydrostatic pressure P = pgz. p = 10003,= 9.81 m2/s. Note that h = 7-z and...

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