Iterate through a logical array

Assignment Help Basic Computer Science
Reference no: EM131222420

You must use either for or while to solve the following problems.

a. Iterate through a vector, A, using a for loop and create a new vector, B, containing logical values. The new vector should contain true for positive values and false for all other values.
For example, if

2278_d8277927-d4ad-4f67-9d10-422c93fe0a09.png

b. Iterate through the vector, A, using a while loop and return a new vector, B, containing true for positive values and false for all other values.

c. Iterate through a logical array, N, using a for loop and return a new vector, M, containing the value 2 wherever an element of N is true and the value -1 (not a logical value) wherever N is false. For example, if
N = [true false false true true false true] the result should
be M = [2 -1 -1 2 2 -1 2]

d. Iterate through an array, Z, using a while loop. Replace every element with the number 3 until you reach a number larger than 50. Leave the rest unchanged. For example, if
Z = [4 3 2 5 7 9 0 64 34 43], after running your script,
Z = [3 3 3 3 3 3 3 3 34 43]

 

 

Reference no: EM131222420

Questions Cloud

How is maintenance planned and controlled : Does your organization collect quantitative data on maintenance activities? If so, what type of data, and how are they used to guide and improve the maintenance process? If not, how is maintenance planned and controlled?
Do you have clear and easily definable boundaries : The model of a good corporation, then, is not one that is too rigid and organized, but one that is capable of exploring the possibilities contained within its body without organs. What would such a corporation look like? Do you think such a corpor..
Simulation experiment using a statistical computer package : Consider the four sample sizes n = 10, 20, 30, and 50, and in each case use 500 replications - For which of these sample sizes does the x‾ sampling distribution appear to be approximately normal?
Describe the type of bond investment program : Describe the type of bond investment program you think the Shuman family should follow.- List several types of bonds that you would recommend for their portfolio and briefly indicate why you would recommend each.
Iterate through a logical array : Iterate through the vector, A, using a while loop and return a new vector, B, containing true for positive values and false for all other values.
What are some different types of stakeholders : Pick a business and describe the various stakeholders that the business has. Why are these people stakeholders? What responsibilities does the business have to these stakeholders?
Value of investment after one year : a. What is the value of your investment after one year? Multiply $3,000 × 1.12. b. What is the value of your investment after two years? Multiply your answer to part a by 1.12. c. What is the value of your investment after three years? Multiply your ..
What are various ways in which the textbook proposes : What are various ways in which the textbook proposes that our understanding of the corporation to its stakeholders can be revised? What are some of the benefits and drawbacks to each proposal?
Financial statements of the company : What impact does the grant of these options have on the financial statements of the company? Explain Answer please.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd