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]
4 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]4 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
A 0.01 significance level is used for a hypothesis test of the claim that when parents use a particular method of gender? select
Nataly_w [17]

Answer:

Option D

H_o equals 0.5 H_a less than 0.5

Explanation:

Information given

N=144

X=66

P=\frac {x}{n}=66/144= 0.458333\approx 0.46

The hypothesis

Null hypothesis

Probability, p =0.5

H_o: p =0.5

Alternative hypothesis

Probability, p<0.5

H_a: p

5 0
4 years ago
In the truss below, the vertical reaction force at A is
Montano1993 [528]
It’s c trust just trust
7 0
3 years ago
The speed of sound in a fluid can be calculated using the following equation:
wlad13 [49]

Answer:

Jesus is always the answer

4 0
3 years ago
How is me depressed or am me not? (but with a yoda voice)
Murrr4er [49]

Answer:

but the way is the way but the WAY is not the way

Explanation:

(yoda voice)

5 0
3 years ago
Read 2 more answers
A steel with 1.0 % carbon is known as which one of the following: (a) eutectoid, (b) hypoeutectoid, (c) hypereutectoid, or (d) w
natta225 [31]

Answer:

Option c)

Explanation:

a.The carbon content of eutectoid steel, which is an carbon- iron alloy, is in between 0.80-0.83%

b. In hypoeutectoid steel, the carbon composition is less than 0.80% and is approximately 0.76%

c. In hypereutectoid steel, the carbon composition ranges from 0.80% - 2.0%

d. In wrought iron, the iron composition is quite low about 0.08%

3 0
3 years ago
Other questions:
  • What are primary and secondary super-heaters?
    9·1 answer
  • Twenty sprint cyclists were randomly selected to be in a study designed to test the effectiveness of 4 weeks of creatine supplem
    6·1 answer
  • A battery rated at 7.2 V and 10000 J is connected across a light bulb. Assume that the internal resistance of the battery is neg
    14·1 answer
  • Consider a nickel wall separating hydrogen gas that is maintained on one side at 5 atm and on the opposite at 3 atm. If the temp
    9·1 answer
  • Which of the following is one of the three basic elements of a blueprint?
    5·1 answer
  • A thermocouple junction is used to measure the temperature of a solid material. The junction is inserted into a small circular h
    6·1 answer
  • A drum contains 3 black balls, 5 red balls and 6 green balls. If 4 balls are selected at random what is the probability that the
    6·1 answer
  • Match the terms with the correct definitions.
    14·1 answer
  • 1.8 A water flow of 4.5 slug/s at 60 F enters the condenser of steam turbine and leaves at 140 F. Determine the heat transfer ra
    13·1 answer
  • A heating torch is usually referred to as what?<br><br> Stick<br> Flower<br> Rose-bud<br> Lighter
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!