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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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

%d bloggers like this: