matlab4 CMU ECR 200 Computer Aided Problem Solving for Engi

matlab4
CMU --·-· ECR 200: Computer Aided Problem Solving for Engineers MATLAB Activity-04 Student Name: 1. What is meant by rellational and logical operators? Provide examples 2. In an automobile manufacturing industry, several materials were tested for hardness, and measurements obtained for each material is listed below. Utizing this information, find: 58 73 7353 5048 56 73 73 66 69 63 74 82 8491 93 89 91 80 59 69 56 64 63 66 64 7463 69 . The materials with a hardness higher than 75 b. The materials with hardness in the range of 65-80. c. Numbers of the material with hardness in the range 50-60 3. During design and build of any engineering system, it is vital to subject it to extensive testing. Accordingy one such mechanical system has been subjected to similar tests. In the process, you are required to create a set of 10 random samples for each of the four pressure systems. Create a random matrix of size 104 using MATLAB functions such as: for loops and rand 4. A 3000 pound vehicle is traveling on a read at 100 ft/sec requires a force of F- ma (m-3000j to stop Write a MATLAB program to calculate the retarding force needed to stop the car at distances d-20, 30, 40, s0-100 fe. Output the values of d and F

Solution

1)

Relational and Logical Operators used in MATLAB:

In General an operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.

MATLAB is specially designed to operate primarily on whole matrices and arrays, thereforeoperators in MATLAB work both on scalar and non scalar data.

Relational Operators:

These operators also work on both scalar and non scalar data, these for arrays perform element by element comparisons between two arrays and return a logical array of the same size, with elements set to logical 1(true) where the relation is true and the elements set to logical 0 (false) where it is not the case.

Following are the relational operators available in MATLAB:

Example:

Apart from above mentioned operators, MATLAB also provides functions/commands used for the same purpose.

Logical Operators:

MATLAB offers two types of logical operators and functions

Element wise logical operators operate element by element on logical arrays, the symbols used are

Short circuit logical operators allow short circuiting on logical operations, the symbols used are:

Example:

Only the first question has been answered.

eq(a, b) Tests whether a is equal to b
ge(a, b) Tests whether a is greater than or equal to b
gt(a, b) Tests whether a is greater than b
le(a, b) Tests whether a is less than or equal to b
lt(a, b) Tests whether a is less than b
ne(a, b) Tests whether a is not equal to b
isequal Tests arrays for equality
isequaln Tests arrays for equality, treating NaN values as equal
matlab4 CMU --·-· ECR 200: Computer Aided Problem Solving for Engineers MATLAB Activity-04 Student Name: 1. What is meant by rellational and logical operators?

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site