Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q . 6 ( H W # 1 0 ) ( 1 ) The following vector represents the distribution of final scores in a course:

Q.6(HW#10)
(1) The following vector represents the distribution of final scores in a course:
G=[68,83,61,70,75,82,57,5,76,85,62,71,96,78,76,68,72,75,83,93]
Write a MATLAB code to determine how many times the final scores are below 75 :
(a) Using for loop.
(b) Using while loop.
(2) A list of 30 exam scores is: 31,70,92,5,47,88,81,73,51,76,80,90,55,23,43,98,36,87,22,61,19,69,26,82,89,99,71,59,49,36.
Write a MATLAB program that determines how many grades are between 0 and 19, between 20 and 39, between 40 and 59, between 60 and 79, and between 80 and 100.
In the program while loop and if statement should be used. The results should be displayed in a table form showing the number of grades in each range.
0.7(HW#10)
(1) The following array P represents the prices, in $, of different goods in a store:
P=[12,7.95,88,26.5,27.9,3.5,57,65.9,17.7,35.6,15,96.5]
A discount strategy is applied as follow:
10% discount for goods that are less than 10$
15% discount for goods that are between 10$ and 30$
20% discount for goods that are above 30$
Write a MATLAB program to define the prices P and returns an array representing the prices after application of the discount. You must use for loop and if statement to find the new prices. Display your results in a table with headings showing the prices before and after discount.
(2) Pascal lower-triangular matrix (L) consists of (m)-rows and (n)-columns can be represented as follows:
Lmxn=([1,0,0,0,0,dots],[1,1,0,0,0,dots],[1,2,1,0,0,dots],[1,3,3,1,0,dots],[1,4,6,4,1,dots],[dots,dots,dots,dots,dots,dots])
Based on the above representation for any row (i) and column (j), the following conditions are true:
The first column and the diagonal positions take the value of 1.
The upper triangle contains zeros.
The rest of the elements is the sum of the two values in the row above it.
Write a MATLAB program to create an (mxn) Pascal lower-triangular matrix (L) according to the following steps:
(a) The program first prompts the user to enter the size of the matrix (enter the number of rows (m) and the number of the columns (n)).
(b) The program calls a MATLAB function named "LowTri"-with 2 inputs and 1 output- and uses a nested-for-loop and branching-if-statement to create Lm.xn.
(c) Execute the program for the case of L7x7 and display the matrix.
(d) Use the matrix obtained to get and then display the Pascal upper-triangular matrix (U7x7) and the Pascal symmetric matrix (S7).
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions

Question

8-6 Who poses the biggest security threat: insiders or outsiders?

Answered: 1 week ago