MatLAB

An online retailer sells five products whose retail prices are as follows: Product 1, $2.98;

product 2, $4.50; product 3, $9.98; product 4, $4.49 and product 5, $6.87. Write a matlab program

that reads a series of pairs of numbers as follows:

a) product number

b) quantity sold

Your program should use a switch statement to determine the retail price for each product. It

should calculate and display the total retail value of all products sold. Use a sentinel-controlled

loop to determine when the program should stop looping and display the final results

product 2, $4.50; product 3, $9.98; product 4, $4.49 and product 5, $6.87. Write a matlab program

that reads a series of pairs of numbers as follows:

a) product number

b) quantity sold

Your program should use a switch statement to determine the retail price for each product. It

should calculate and display the total retail value of all products sold. Use a sentinel-controlled

loop to determine when the program should stop looping and display the final results

MatLAB

How many times will this loop print 'Hello World'?

n = 10;

while n > 0

disp('Hello World')

n = n - 1;

end

n = 10;

while n > 0

disp('Hello World')

n = n - 1;

end

how do i use : to assign the second column of the matrix M to a vector fmodel and the third column to a vector fexperiment. Can you show me an example please

MatLAB

Mechanical springs are said to be connected "in series" if the same force passes

through each and "in parallel" if the deflections in all the springs are equal.

If in parallel, their equivalent stiffness is given by

k=k1+k2+…+kn

If in series the equivalent stiffness is given by

1

through each and "in parallel" if the deflections in all the springs are equal.

If in parallel, their equivalent stiffness is given by

k=k1+k2+…+kn

If in series the equivalent stiffness is given by

1

I'm writing this code to play battleship against the computer and I've written the code to the point where I can get all the ships placed (battleship- 4 cells long, submarine- 3 cells long, cruiser- 2 cells long, and destroyer- 1 cell). But now I have to make the computer randomly guess spots on the board(9x9) and check to see if it hits one of the ships. The computer gets 29 missiles and if the computer doesn't get a hit for 7 guesses to automatically hit a ship. Please help I've been messing around with loops all day and can't get it right. Thank you.

22.Write a script that will generate random integers in the range from 0 to 50,and print them,until one is finally generated that is greater than 25. The script should print how many attempts it took.

15. Write a script that will print the following multiplication table:

1

2 4

3 6 9

4 8 12 16

5 10 15 20 25

1

2 4

3 6 9

4 8 12 16

5 10 15 20 25

8.Write a script that will:

generate a random integer in the inclusive range from 2 to 5

loop that many time to prompt the user for a number'prompt the sum of the numbers entered so far with one decimal place

generate a random integer in the inclusive range from 2 to 5

loop that many time to prompt the user for a number'prompt the sum of the numbers entered so far with one decimal place

QUIZ 2

Imagine it takes 1 second to make 1 count. Each count can be a maximum of 5 persons (this is being realistic; we humans don’t have the capacity for more than this). If there are 4 billion people in the room, can you think of a method we can use to count them in under 50 seconds?

Imagine it takes 1 second to make 1 count. Each count can be a maximum of 5 persons (this is being realistic; we humans don’t have the capacity for more than this). If there are 4 billion people in the room, can you think of a method we can use to count them in under 50 seconds?

MatLAB

Program to store prime numbers upto 1000 in an array