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
Hello 10 points if my Chromebook is on 26 percent how much time do I have left theoretically
velikii [3]
About 15 minutes.......
7 0
3 years ago
Read 2 more answers
What are the programming concepts (within or outside the scope of IT210) that you would like to strengthen and delve into furthe
marin [14]

Answer:

The description for the given question is described in the explanation section below.

Explanation:

I would like to reinforce in advanced or complex concepts such as documents as well as channels, internet programming, multi-threading, after that last lesson.

  • I am interested in learning web development to develop applications or software. I would also like to explore those concepts by using open source tools.
  • Course concepts will have to develop models for handling.
  • No there is no subject matter or definition you provide further clarity for.
  • I'm interested in studying java as well as web development in comparison to C++ so I can use it in my contract work.
4 0
3 years ago
Which of the following statements is not true? Group of answer choices
Nesterboy [21]

Answer:

A

Explanation:

Option A is not true because a Boolean variable type can hold one of two values only that is  (true/True or false/False).

All the other options given in the question are correct because

  1. A variable declaration refers to specifying its type and name
  2. If string variables are assigned a numeric values which is legal provided the values are enclosed in quaotes( " "), trying to carryout a mathematical operation like addition will result in string concatenation.
  3. The Variable name I_Love_to_eat_pizza is legal because it contains no special characters, doesn't start with a number and its not a reserved word in any language
4 0
3 years ago
List 2 advantages Cryptocurrency have over regular bank transactions
ratelena [41]

Answer:

low transaction fees and speedier processing

Explanation:

5 0
2 years ago
Read 2 more answers
Write a program that calculates payments for loan system. Implement for both client and Server. - The client sends loan informat
egoroff_w [7]

Answer:

Check the explanation

Explanation:

//Define the class.

public class Loan implements java.io.Serializable {

 

//Define the variables.

private static final long serialVersionUID = 1L;

private double annualInterestRate;

private int numberOfYears;

private double loanAmount;

private java.util.Date loanDate;

//Define the default constructor.

public Loan() {

this(2.5, 1, 1000);

}

//Define the multi argument constructor.

protected Loan(double annualInterestRate, int numberOfYears,

double loanAmount) {

this.annualInterestRate = annualInterestRate;

this.numberOfYears = numberOfYears;

this.loanAmount = loanAmount;

loanDate = new java.util.Date();

}

//Define the getter and setter method.

public double getAnnualInterestRate() {

return annualInterestRate;

}

public void setAnnualInterestRate(double annualInterestRate) {

this.annualInterestRate = annualInterestRate;

}

public int getNumberOfYears() {

return numberOfYears;

}

public void setNumberOfYears(int numberOfYears) {

this.numberOfYears = numberOfYears;

}

public double getLoanAmount() {

return loanAmount;

}

public void setLoanAmount(double loanAmount) {

this.loanAmount = loanAmount;

}

//Define the method to compute the monthly payment.

public double getMonthlyPayment() {

double monthlyInterestRate = annualInterestRate / 1200;

double monthlyPayment = loanAmount * monthlyInterestRate / (1 -

(Math.pow(1 / (1 + monthlyInterestRate), numberOfYears * 12)));

return monthlyPayment;  

}

//Define the method to get the total payment.

public double getTotalPayment() {

double totalPayment = getMonthlyPayment() * numberOfYears * 12;

return totalPayment;  

}

public java.util.Date getLoanDate() {

return loanDate;

}

}

//Define the client class.

public class ClientLoan extends Application {

 

//Create the server object.

ServerLoan serverLoan;

 

//Declare the variables.

int y;

double r, a, mp=0, tp=0;

String result,d1;

 

//Create the button.

Button b = new Button("Submit");

 

//Define the method stage.

public void start(Stage primaryStage) throws Exception {

 

TimeZone.setDefault(TimeZone.getTimeZone("EST"));

TimeZone.getDefault();

d1 = "Server Started at " +new Date();

 

//Create the GUI.

Label l1=new Label("Annual Interest Rate");

Label l2 = new Label("Number Of Years:");

Label l3 = new Label("Loan Amount");

TextField t1=new TextField();

TextField t2=new TextField();

TextField t3=new TextField();

TextArea ta = new TextArea();

 

//Add the components in the gridpane.

GridPane root = new GridPane();

root.addRow(0, l1, t1);

root.addRow(1, l2, t2, b);

root.addRow(5,l3, t3);

root.addRow(6, ta);

 

//Add gridpane and text area to vbox.

VBox vb = new VBox(root, ta);

 

//Add vbox to the scene.

Scene scene=new Scene(vb,400,250);

 

//Add button click event.

b.setOnAction(value -> {

 

//Get the user input from the text field.

r = Double.parseDouble(t1.getText());

y = Integer.parseInt(t2.getText());

a = Double.parseDouble(t3.getText());

 

//Create the loan class object.

Loan obj = new Loan(r, y, a);

 

//Call the method to compute the results.

mp = obj.getMonthlyPayment();

tp = obj.getTotalPayment();

 

//Format the results.

result = "Annual Interest Rate: "+ r+"\n"+

"Number of Years: "+y+"\n"+

"Loan Amount: "+a+"\n"+

"monthlyPayment: "+mp+"\n"+

"totalPayment: "+tp;

 

//Add the result to the textarea.

ta.setText(result);

 

//Create an object of the server class.

serverLoan = new ServerLoan(this);

});

 

//Set the scene to the stage.

//Set the stage title.

//Make the scene visible.

primaryStage.setScene(scene);

primaryStage.setTitle("ClientLoan");

primaryStage.show();

}

 

//Define the main method lauch the application.

public static void main(String args[])

{  

launch(args);

}

 

//Define the server class.

class ServerLoan extends Stage {

 

//Create the client loan object.

ClientLoan parent;

 

//Create the stage object.

Stage subStage;

 

//Create the text area.

TextArea ta = new TextArea();

 

//Define the constructor.

private ServerLoan(ClientLoan aThis) {

 

//Get the time in desired timezone.

TimeZone.setDefault(TimeZone.getTimeZone("EST"));

TimeZone.getDefault();

 

//Format the date with message.

String d2 = "Connected to client at " +new Date();

 

//Initialize the object.

parent = aThis;

 

//Add the date and the result to

//the text area.

ta.setText(d1);

ta.appendText("\n"+ d2);

ta.appendText("\n"+result);

 

//Create the grouppane.

GridPane root = new GridPane();

 

//Add text area to the group pane.

root.addRow(0, ta);

 

//Initialise the stage object.

subStage = new Stage();

 

//Add gridpane to the scene.

Scene scene = new Scene(root, 400, 200);

 

//Set the scene to the stage.

//Set the stage title.

//Make the scene visible.

subStage.setScene(scene);

subStage.setTitle("ServerLoan");

subStage.show();

}

}

}

Kindly check the Output in the attached image below.

4 0
3 years ago
Read 2 more answers
Other questions:
  • A server-side extension ________________. provides its services to the web server in a way that is totally transparent to the cl
    13·1 answer
  • The "origin" of the cartesian plane in math is the point where x and y are both zero. Given a variable, origin of type Point-- a
    5·1 answer
  • Your task is to write a C program that measures the latencies of various system calls. In particular, you want to know 1) the co
    5·1 answer
  • Myles is studying a system to lessen the number of complaints about the Help Desk. He has formally studied the service counter a
    5·1 answer
  • What do people do when they navigate using GPS
    6·2 answers
  • What aspects of your life are most influenced by media and technology​
    14·1 answer
  • Briefly describe the traditional definition of the digital divide. What is it and who is affected, positively and adversely? How
    15·1 answer
  • How to set Campaign goals?
    11·1 answer
  • Anyone have any website ideas I could use for my computing website project? Thank you.
    15·2 answers
  • Choose the answer.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!