The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Â
Pre-Lab 6CS 122L - 5 Points TotalObjectivesThe objectives are to introduce the following concepts:vector element accesscompound conditional statementspie chartsDeliverablesSubmit your pre-lab answers in Bb Learn under the Lab 6 pre-lab assignment area prior to thestart of class1. We can access certain elements of a vector by specifying the index of the value we want inparentheses after the vector’s name. Suppose we have a vector x = [1 5 3 6 3]. We would typex(2) to get the second value in the x vector or x(4) to get the fourth value in the x vector. If wewant to multiply the fifth value in the x vector by 3, we would write x(5) = x(5) * 3.Write the MATLAB code to add 1 to the third element of the x vector.2. We can check for more than one condition in an if statement or while loop with the use oflogical operators. The logical AND (&&) operator connects two Boolean values. If both of theBoolean values are true, then the expression returns true. Otherwise, the expression returnsfalse. The logical OR (||) operator also connects two Boolean values. If either of the Booleanvalues are true, then the expression returns true. Otherwise, the expression returns false. Notethat compound conditional operators can be chained together to make complex expressions.i) The following would execute the code inside the while loop as long as a is greater than 7 or bis greater than 9. The code inside of the while loop adjusts the values of a and b so that there isnot an infinite loop.a = 14;b = 12;while a >7 || b >9a = a – 2;b = b – 1;end
Attachments:
-----------