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
To become familiar with the general equations of plane strain used for determining in-plane principal strain, maximum in-plane s
lukranit [14]

Answer:

a) -1.46 x 10∧-5, 1.445x 10∧-4, -6.355 x 10∧-4

b) 3.926 x 10∧-4, -2.626 x 10∧-4

c) 6.552 x 10∧-4, 6.5 x 10∧-5

Explanation:

a) -1.46 x 10∧-5, 1.445x 10∧-4, -6.355 x 10∧-4

b) 3.926 x 10∧-4, -2.626 x 10∧-4

c) 6.552 x 10∧-4, 6.5 x 10∧-5

The explanation is shown in the attachment. I hope i have been able to help.

3 0
3 years ago
What is 94*738^389428394
Lady_Fox [76]

Answer:

undefined

Explanation:

3 0
3 years ago
How much horse power does a Lamborghini have
statuscvo [17]
The Lamborghini SCV12 has 830 horse power.
4 0
2 years ago
Read 2 more answers
A 60-cm-high, 40-cm-diameter cylindrical water tank is being transported on a level road. The highest acceleration anticipated i
dlinn [17]

Answer:

h_{max} = 51.8 cm

Explanation:

given data:

height of tank = 60cm

diameter of tank =40cm

accelration = 4 m/s2

suppose x- axis - direction of motion

z -axis - vertical direction

\theta = water surface angle with horizontal surface

a_x =accelration in x direction

a_z =accelration in z direction

slope in xz plane is

tan\theta = \frac{a_x}{g +a_z}

tan\theta = \frac{4}{9.81+0}

tan\theta =0.4077

the maximum height of water surface at mid of inclination is

\Delta h = \frac{d}{2} tan\theta

            =\frac{0.4}{2}0.4077

\Delta h  0.082 cm

the maximu height of wwater to avoid spilling is

h_{max} = h_{tank} -\Delta h

            = 60 - 8.2

h_{max} = 51.8 cm

the height requird if no spill water is h_{max} = 51.8 cm

3 0
3 years ago
Which type of memory is programmed at the factory? RAM ROM Cache or Virtual memory
12345 [234]

Answer:

RAM, which stands for random access memory, and ROM, which stands for read-only memory, are both present in your computer. RAM is volatile memory that temporarily stores the files you are working on. ROM is non-volatile memory that permanently stores instructions for your computer.

Explanation:

5 0
3 years ago
Other questions:
  • PLEASE HELP 100 POINTS!!! WILL MARK BRAINLIEST
    9·2 answers
  • The type of current that flows from the electrode across the arc to the work is called what?
    5·1 answer
  • Design a PI controller to improve the steady-state error. The system should operate with a damping ratio of 0.8. Compute the ove
    10·1 answer
  • Source water pollution in Madagascar
    14·1 answer
  • Describe the are of mechanical engineering
    6·2 answers
  • PLEASE HELP!<br> I'm in the middle of a test and the teacher didn't go over the material!
    10·1 answer
  • What is the answer???
    10·1 answer
  • At what distance from the Earth’s surface is a 10,000 kg satellite if its potential energy is equal to –5.58 x 1011 J? (choose t
    5·1 answer
  • What setting do i dry my jordan max arua 2s on in the dryer <br>will mark brainliest
    8·1 answer
  • Which of the following is not a relationship set between elements in a sketch​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!