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
bogdanovich [222]
3 years ago
13

Consider the following arrays. 1 4 21 2 4 100 B # 111(A) L3π 42 Write MATLAB expressions to do the tollowing a. Select just the

second row of B. b. Evaluate the sum of the second row of B. c. Multiply the second column of B and the first column of A element by element. d. Evaluate the maximum value in the vector resulting from element-by- element multiplication of the second column of B with the first column of A. e. Use element-by-element division to divide the first row of A by the first three elements of the third column of B. Evaluate the sum of the elements of the resulting vector
Computers and Technology
1 answer:
andriy [413]3 years ago
6 0

Answer:

Complete Matalb code along with explanation and output results are given below

Explanation:

We are given following two matrices A and B of size 4x3

A = [1 4 2; 2 4 100; 7 9 7; 3 pi 42]

B = log(A)

(a) Select just the second row of B

% to extract any row use this syntax  B(row no, : )  we can also extract more than 1 row or any particular elements in a specific row

B_row_2 = B(2,:)

(b) Evaluate the sum of the second row of B

% simply use the sum function and pass it any vector or matrix and it will return their sum

sum_B_row_2 = sum( B_row_2(:) )  

(c) Multiply the second column of B and the first column of A element by element

% first we extract the column 2 of matrix B and column 1 of matrix A. use this syntax  B( : ,col no ) to extract any column  

B_col_2 = B(:,2)

A_col_1 = A(:,1)

% Then we use ( .*) to multiply element by element. To use standard multiplication of matrices only use asterisk sign without coma

multiply=B_col_2.*A_col_1

(d) Evaluate the maximum value in the vector resulting from element-by- element multiplication of the second column of B with the first column of A

% we can find the maximum value in a vector or matrix by using max function so we pass the multiply variable where our result was stored

max_value = max(multiply)

(e) Use element-by-element division to divide the first row of A by the first three elements of the third column of B. Evaluate the sum of the elements of the resulting vector

%  First we extract the row 1 of matrix A

A_row_1 = A(1,:)

%  Then we extract the column 3 of matrix B

B_col_3 = B(:,3)

%  Then we extract the first 3 elements of column 3 of matrix B

B_col_3 = B_col_3(1:3)

% Finally we use ( ./ ) to use element by element division

divide = A_row_1./B_col_3

% Using the sum function again results in the addition of entire elements of resultant matrix

sum_divide = sum( divide(:) )

Only Code:

A = [1 4 2; 2 4 100; 7 9 7; 3 pi 42]

B = log(A)

B_row_2 = B(2,:)

sum_B_row_2 = sum( B_row_2(:) )  

B_col_2 = B(:,2)

A_col_1 = A(:,1)

multiply=B_col_2.*A_col_1

max_value = max(multiply)

A_row_1 = A(1,:)

B_col_3 = B(:,3)

B_col_3 = B_col_3(1:3)

divide = A_row_1./B_col_3

sum_divide = sum( divide(:) )

Output Results:

A =

    1.0000     4.0000     2.0000

    2.0000     4.0000   100.0000

    7.0000     9.0000     7.0000

    3.0000     3.1416    42.0000

B =  

  0.00000   1.38629   0.69315

  0.69315   1.38629   4.60517

  1.94591   2.19722   1.94591

  1.09861   1.14473   3.73767

B_row_2 =   0.69315   1.38629   4.60517

sum_B_row_2 =  6.6846

B_col_2 =  

  1.3863

  1.3863

  2.1972

  1.1447

A_col_1 =

  1

  2

  7

  3

multiply =

   1.3863

   2.7726

  15.3806

   3.4342

max_value =  15.381

A_row_1 =     1   4   2

B_col_3 =  

  0.69315

  4.60517

  1.94591

  3.73767

B_col_3 =

  0.69315

  4.60517

  1.94591

divide =

  1.44270   5.77078   2.88539

  0.21715   0.86859   0.43429

  0.51390   2.05559   1.02780

sum_divide =  15.216

You might be interested in
The image type used for graphics that need smaller sizes with no loss of quality is a ___________.
Novosadov [1.4K]
I believe the answer it TIF 
4 0
3 years ago
Edhesive lesson practice 8.3, question 5
scZoUnD [109]

Answer:

3

Explanation:

8 0
3 years ago
Which computers were the first PCs with a GUI<br> MS-DOS <br> Linux<br> Windows<br> Mac
sergeinik [125]

Answer:

The first computer with a GUI were linux, microsoft and apple.

Explanation:

I think this is right. Hope it helped <3

8 0
3 years ago
Read 2 more answers
Create a new method in your language called Times Print. This should be a void method. It should accept exactly two numeric valu
user100 [1]

Answer:

The code commented is given below, also the lines that start with # are comments that explains the code.

# Create a function named times_print that receives 2 values x and y

def times_print(x, y):

   # Print the formatted string

   print("The value of {} times {} is {}".format(x,y,x*y))

# Create the main function

def main():

   # Call the funciton times_print 3 times with different values

   times_print(2,3)

   times_print(4,5)

   times_print(5,6)

# Execute the main function

main()

Explanation:

The code was written using Python 3.5, and here I attach the screenshots of the program running:

8 0
4 years ago
In this lab, you will implement a temperature converter in JavaScript. The user may type a temperature in either the Celsius or
jek_recluse [69]

Use the knowledge in computational language in JAVA to write a code that convert the temperature.

<h3>How do I convert Celsius to Fahrenheit in Java?</h3>

So in an easier way we have that the code is:

  • Fahrenheit to celsius:

<em>/* When the input field receives input, convert the value from fahrenheit to celsius */</em>

<em>function temperatureConverter(valNum) {</em>

<em>  valNum = parseFloat(valNum);</em>

<em>  document.getElementById("outputCelsius").innerHTML = (valNum-32) / 1.8;</em>

<em>}</em>

  • Celsius to Fahrenheit:

<em>function cToF(celsius) </em>

<em>{</em>

<em>  var cTemp = celsius;</em>

<em>  var cToFahr = cTemp * 9 / 5 + 32;</em>

<em>  var message = cTemp+'\xB0C is ' + cToFahr + ' \xB0F.';</em>

<em>    console.log(message);</em>

<em>}</em>

<em>function fToC(fahrenheit) </em>

<em>{</em>

<em>  var fTemp = fahrenheit;</em>

<em>  var fToCel = (fTemp - 32) * 5 / 9;</em>

<em>  var message = fTemp+'\xB0F is ' + fToCel + '\xB0C.';</em>

<em>    console.log(message);</em>

<em>} </em>

<em>cToF(60);</em>

<em>fToC(45);</em>

See more about JAVA at brainly.com/question/12975450

5 0
2 years ago
Other questions:
  • For film editors, which task comes last in their workflow pattern?
    12·2 answers
  • Derek has an interest in designing video games. What requirements should he fulfill to be a game designer?
    13·1 answer
  • How can my computer catch a virus?
    13·1 answer
  • Consider a router that interconnects three subnets: subnet 1, subnet 2, and subnet 3. suppose all of the interfaces in each of t
    11·2 answers
  • Once sales are​ forecasted, ________ must be generated to estimate required raw materials. A. a pro forma statement B. a product
    8·1 answer
  • To comply with ATC instructions for altitude changes of more than 1,000 feet, what rate of climb or descent should be used?
    5·1 answer
  • Many contemporary languages allow two kinds of comments: one in which delimiters are used on both ends (multiple-line comments),
    7·1 answer
  • Write code that prompts for three integers, averages them, and prints the average. Make your code robust against invalid input;
    7·1 answer
  • A customer seeks to buy a new computer for a private use at home.The customer primarily needs the computer to use the Microsoft
    8·1 answer
  • What happens when an arithmetic operator is applied to non-arithmetic data types such as Boolean or character
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!