Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Great news! You have just been selected to appear on Jeopardy this fall. You dec

ID: 3754015 • Letter: G

Question

Great news! You have just been selected to appear on Jeopardy this fall. You decide that it might be to your advantage to generate an array representing the values of the questions onthe board. Write a script to generate the matrix jeopardy that consists of six columns and five rows. The columns are all identical, but the values of the rows range from 200 to 1,000 in equal increments. Next, generate the matrix doubleJeopardy, which has the same dimensions as jeopardy but whose values range from 400 to 2,000. You’ve decided to go even one step further and practice for a round that doesn’t even exist yet. Generate the matrix squaredJeopardy that contains each entry of the original jeopardy matrix squared.

Explanation / Answer

1. Write a script to generate the matrix jeopardy that consists of six columns and five rows. The columns are all identical, but the values of the rows range from 200 to 1,000 in equal increments.

Answer:

%create a vector starting at 6 and including all evens through 33

evens = (6:2:33)

%create a vector starting at 8 and including every third number through 38

threes = (8:3:38)

%creat a vector starting at 20 and counting backwards by 1 through 10

reverse = (20:-1:10)

%create a vector containing 100 evenly spaced values between 0-2pi

theta = (0:((2*pi)/100):2*pi)

%construct a vector of 15 elements containing all zeros

myzeros= zeros(1,15)

%construct a vector containing 15 randomly generated numbers 1-12

random = round(12*rand(1,15))

********************************************************************************************************************

2. Next, generate the matrix doubleJeopardy, which has the same dimensions as jeopardy but whose values range from 400 to 2,000. You’ve decided to go even one step further and practice for a round that doesn’t even exist yet.

Answer:

%script name: hw3part2

%script writer: Matthew Collins

%create a vector with 45 8 2 6 98 55 45 -48 75

vec = [45 8 2 6 98 55 45 -48 75]

%create a vector with only the odd numbers

%you must use a boolean statement to achieve this

vec = vec(mod(vec,2)==1)

%create a variable to determine vec length

vLength = length(vec)

%Add up the elements in the vector vec

vSum = sum(vec)

%Get the average of the values in the vector vec in 2 ways

vecAverage1 = mean(vec)

vecAverage2 = vSum/vLength

%Create a variable to find the product of the values held in vec

vProd = prod(vec)

********************************************************************************************************************

3. Generate the matrix squaredJeopardy that contains each entry of the original jeopardy matrix squared.

Answer:

%script name: hw3part3

%script writer: Matthew Collins

%creat 2 vectors named A1 and B1

A1 = [1 34 67]