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 battery provides electricity in the state of ?
lys-0071 [83]

Answer:

Essentials. A battery is a device that stores chemical energy and converts it to electrical energy. The chemical reactions in a battery involve the flow of electrons from one material (electrode) to another, through an external circuit. The flow of electrons provides an electric current that can be used to do work.

7 0
3 years ago
Which of the following describes a tropical grassland environment?
SOVA2 [1]
It would be the last one I’m pretty sure
7 0
3 years ago
Read 2 more answers
A metal having a cubic structure has a density of , an atomic weight of , and a lattice parameter of Å One atom is associated wi
Veronika [31]

Answer:

Explanation:

Answer: The crystal structure of the metal is BCC

Explanation:

we first calculate the volume of the unit cell.

Volume of unit cell= (a°)^3.

The lattice parameter here is a°.

Substitute (6.13 * 10^-8)cm for a°.

Volume of unit cell = (6.13 * 10^-8)^3 = 2.3034 * 10^-22 cm^3/cell.

To determine the crystal structure we use

Density (p) = {(Number of atoms per cell) (Atomic mass)} / {(volume of unit cell)(Avogrado constant)}.

Substitute 1.892g/cm^3 for p (6.02*10^23) atoms/mol for Avogrado constant 1.3921g/mol.

For atomic mass and (2.3034 * 10^-22) cm^3/cell for unit cell.

1.892g/cm^3 = {(Number of atoms per cell) (1.3291g/mol)} / {(2.3034 * 10^-22) (6.02 * 10^23 atoms/mol)}.

Changing the subject of formula we have :

Number of atoms per cell = {(2.3034 * 10^-22) * (6.02 * 10^23) * 1.892} / 132.91

Number of atoms per cell = 2.

Since the number of atoms per cell is 2, :. the crystal structure of metal is BCC.

Note: p = density

a° = a subscript o

4 0
3 years ago
When calculating a resolved shear stress within a single unit cell, the angle between the applied stress direction and the slip
givi [52]

Answer: 35.3 °

Explanation:

Body-centered cubic lattice (bcc or cubic-I), just like all lattices, has lattice points at the eight corners of the unit cell with an additional points at the center of the cell. It has unit cell vectors a = b = c and interaxial angles α=β=γ=90°.

The simplest crystal structures are those that have present only a single atom at each lattice point.

body-centered cubic unit cell has atoms at each of the eight corners of a cube (like the cubic unit cell) plus one atom in the center of the cube. Each of the corner atoms is the corner of another cube so the corner atoms are shared between eight unit cells. It is said to have a coordination number of 8. The bcc unit cell consists of a net total of two atoms; one in the center and eight eighths from corners atoms

With the use of BCC unit cell, if a applied stress is in [110] direction, but slip applies in [111] direction, the angle between applied direction and slip direction is given as:

[1 1 0] [1 1 1]

λ = Cos^-1 ( 1×1 + 1×1 + 0×1 ÷ (1^2 + 1^2 +0^2) (1^2 + 1^2+ 1^2))

Cos^-1 2/ sqrt 6

= 35.386°

6 0
3 years ago
Find the resultant of two forces 130 N and 110 N respectively, acting at an angle whose tangent
monitta

Answer:

F_r = 200N

Explanation:

Given

Let the two forces be

F_1 = 130N

F_2 = 110N

and

\tan(\theta) = \frac{12}{5}

Required

Determine the resultant force

Resultant force (Fr) is calculated using:

F_r^2 = F_1^2 + F_2^2 + 2F_1F_2\cos(\theta)

This means that we need to first calculate \cos(\theta)

Given that:

\tan(\theta) = \frac{12}{5}

In trigonometry:

\tan(\theta) = \frac{Opposite}{Adjacent}

By comparing the above formula to \tan(\theta) = \frac{12}{5}

Opposite = 12

Adjacent = 5

The hypotenuse is calculated as thus:

Hypotenuse^2 = Opposite^2 + Adjacent^2

Hypotenuse^2 = 12^2 + 5^2

Hypotenuse^2 = 144 + 25

Hypotenuse^2 = 169

Hypotenuse = \sqrt{169

Hypotenuse = 13

\cos(\theta) is then calculated using:

\cos(\theta)= \frac{Adjacent}{Hypotenuse}

\cos(\theta)= \frac{5}{13}

Substitute values for F_1, F_2 and cos(\theta) in

F_r^2 = F_1^2 + F_2^2 + 2F_1F_2\cos(\theta)

F_r^2 = 130^2 + 110^2 + 2*130*110*\frac{5}{13}

F_r^2 = 16900 + 12100 + 11000

F_r^2 = 40000

Take square roots of both sides

F_r = \sqrt{40000

F_r = 200N

<em>Hence, the resultant force is 200N</em>

4 0
3 years ago
Other questions:
  • Asap asap plz help maxium points
    6·2 answers
  • A two-stage compression refrigeration system operates with refrigerant-134a between the pressure limits of 1.4 and 0.10 MPa. The
    6·1 answer
  • An air conditioner is designed to bring 10,000 ft3/min of outside air (90°F, 29.8 inches Hg, 88% relative humidity) to 40°F, the
    9·1 answer
  • What is arduino and for what it is used​
    12·1 answer
  • The supplement file* that enclosed to this homework consists Time Versus Force data. The first column in the file stands for tim
    13·1 answer
  • Represent each of the following units as a combination of primitive
    11·1 answer
  • I just need help on problem B
    9·1 answer
  • Describe SIX basic ways of installing wire ways​
    11·1 answer
  • In the event of an OSHA or EPA Inspection. If you have concerns about your level of compliance, you should not
    13·1 answer
  • The area of piston 1 is 15 times smaller than the area of piston 2. If you want to lift the car 1ft, how much you should push do
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!