# logical operators:MATLAB

logical operators: MATLAB

Problem 1

Using logical operators, write a code that finds the values for which the vector π₯ is in the range of 47 β€ π₯ β€ 67 Where the vector π₯ is: π₯ = [47, 54, 34, 23, 55, 67, 98, 97, 54]

Problem 2

Write a program that allows the user to input a certain number from 1 to 100. When the entered value is less than or equal to 50, have the program display the words βThis value is less than or equal to 50β. If the value if greater than 50, have it display βThis value is greater than 50β. Make sure to take into account the condition in which the entered number is not valid. If the number is not valid, have the program display some type of error message.

Problem 3

Write a program that uses the ππππ() function in MATLAB to find the values inside the matrix π that are greater than the value of six. Where the matrix π is: π = [ 5, 4, 7 10, 22, 4 20, 44, 1 ]

Problem 4

Write a program that takes in a city name as a string and displays the gas price in that city using a switch statement. Use the following table in your program: City Gas Price Los Angeles \$2.45 San Diego \$2.43 San Francisco \$2.54

This site uses Akismet to reduce spam. Learn how your comment data is processed.