1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Naily [24]
3 years ago
13

Write a program that asks the user to input a vector of integers of arbitrary length. Then, using a for-end loop the program exa

mines each element of the vector. If the element is positive, its value is doubled. If the element is negative, its value is tripled. The program displays the vector that was entered and the modified vector. Execute the program, and when the program ask the user to input a vector type randi([−10 20], 1, 19). This creates a 19-element vector with random integers between −10 and 20.
Engineering
1 answer:
ELEN [110]3 years ago
4 0

Answer:

%Program prompts user to input vector

v = input('Enter the input vector: ');

%Program shows the value that user entered

fprintf('The input vector:\n ')

disp(v)

%Loop for checking all array elements

for i = 1 : length(v)

   %check if the element is a positive number

   if v(i) > 0

       %double the element

       v(i) = v(i) * 2;

   %else the element is negative number.

   else

       %triple the element

       v(i) = v(i) * 3;

   end

end

%display the modified vector

fprintf('The modified vector:\n ')

disp(v)

You might be interested in
How much work, in Newtons, is required to lift a 20.4-kg (45lb) plate from the ground to a stand that is 1.50 meters up?
nataly862011 [7]

Answer:

Explanation:

Work, U, is equal to the force times the distance:

U = F · r

Force needed to lift the weight, is equal to the weight: F = W = m · g

so:

U = m · g · r

   = 20.4kg · 9.81 \frac{N}{kg} · 1.50m

   = 35.316 \frac{N}{m}

   = 35.316 W

4 0
2 years ago
Technician A states that a brake lathe is used to make a used brake rotor surface "like new". Technician B states that a brake l
nikitadnepr [17]

Answer:

Both Technician A and B are correct.

Explanation: A brake lathe is a special tool used to improve or work on the surface of brake pads it helps to smoothen the surface.

Brake lathe has been found to be very effective in removing rusts in rotors and unevenness in the brake pad surfaces in order to ensure the efficiency and effectiveness of the brake system of a vehicle. Hence, a brake lathe helps to make brake rotor surface as smooth as possible.

7 0
2 years ago
A negative pressure respirator brings fresh air to you through a hose<br>A) True<br>B)False​
madreJ [45]

Answer:FALSE

Explanation: A negative pressure respirator is a respiratory system which is known to have a low air pressure inside the mask when compared to the air pressure on the outside during Inhalation.

Most of the personal protective equipment (PPE) which are in use in various industries are examples of Negative pressure respirator device,any leak or damage done to the device will allow the inflows of harmful and toxic Air into the person's respiratory system. AIR SUPPLY SYSTEMS ARE KNOWN TO SUPPLY FRESH UNCONTAMINATED AIR THROUGH AIR STORED INSIDE COMPRESSED CYLINDERS OR OTHER SOURCES AVAILABLE.

8 0
3 years ago
Read 2 more answers
Please help i am give brainliest
Korolek [52]

Answer:

A C power is the answer

hope this helps

6 0
2 years ago
Read 2 more answers
When you first start a car after it has been sitting for more than an hour, it pollutes up to ......times more than when the eng
lesya [120]
20 time more then when it’s warm
6 0
3 years ago
Read 2 more answers
Other questions:
  • 9 b. A sign (including the post and base) weighs 40 pounds and is
    8·1 answer
  • A turbine operates at steady state, and experiences a heat loss. 1.1 kg/s of water flows through the system. The inlet is mainta
    6·1 answer
  • The viscosity of the water was 2.3×10^−5lb⋅⋅s/ft^2 and the water density was 1.94 slugs/ft^3. Estimate the drag on an 88-ft diam
    13·1 answer
  • Which element of Miranda's character is best illustrated by this excerpt?
    15·1 answer
  • • Differentiate between laboratory and industrial reactors​
    11·1 answer
  • When could you use the engineering design process in your own life?
    9·1 answer
  • Which rules of the road apply to people riding bicycles, under Illinois law? *
    9·1 answer
  • An add tape of 101 ft is incorrectly recorded as 100 ft for a 200-ft distance. What is
    6·1 answer
  • PLZZZZZ HELP
    10·2 answers
  • The density of a certain type of steel is 8.1 g/cm3. What is the mass of a 100 cm3 chunk of this steel
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!