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
ANEK [815]
3 years ago
5

(14 points) Consider the Matrix, M = 16 2 3 13 5 11 10 8 9 7 6 12 4 14 15 1 . Using the index operations write MATLAB statements

to retrieve the following. (a) The value in the first row and second column(ie. 2) (b) The value in the third row and third column (ie. 6) (c) All the elements in the first row (d) All the elements in the second column (e) All the elements in the first 2 rows (row 1 & 2) (f) All the elements in the last 2 columns (columns 3 & 4) (g) The elements 3 13 10 8
Computers and Technology
1 answer:
Sonja [21]3 years ago
8 0

Answer:

The Matlab commands for the given index operations and corresponding outputs are given below.

Explanation:

clc   % is used to clear the command window of the Matlab

clear all   % is used to clear the variables stored in Matlab workspace

% We are given a 4x4 matrix

Matlab command:

M = [16 2 3 13; 5 11 10 8; 9 7 6 12; 4 14 15 1]

output:

M =

   16     2     3    13

    5    11    10     8

    9     7     6    12

    4    14    15     1

(a) The value in the first row and second column (ie. 2)

Matlab command:

a = M(1,2)

% where a = Matrix(row_1,column_2)

output:

a =

    2

(b) The value in the third row and third column (ie. 6)

Matlab command:

b = M(3,3)

% where b = Matrix(row_3,column_3)

output:

b =

     6  

(c) All the elements in the first row

Matlab command:

c = M(1,:)

% where c = Matrix(row_1,:)

output:

c =

   16     2     3    13

(d) All the elements in the second column

Matlab command:

d = M(:,2)

% where d = Matrix(:,column_2)

output:

d =

    2

   11

    7

   14

(e) All the elements in the first 2 rows (row 1 & 2)

Matlab command:

e = M([1,2],:)

% where e = Matrix([row_1,row_2],:)

output:

e =

   16     2     3    13

    5    11    10     8  

(f) All the elements in the last 2 columns (columns 3 & 4)

Matlab command:

f = M(:,[3,4])

% where f= Matrix(:,[column_3,column_4])

output:

f =  

    3    13

   10     8

    6    12

   15     1

(g) The elements 3 13 10 8

Matlab command:

g = [M(1,3) M(1,4); M(2,3) M(2,4)]

% where g = Matrix(row_1,column_3) M(row_1,column_4); M(row_2,column_3), M(row_2,column_4)

output:

g =

    3    13

   10     8

You might be interested in
Write a python program to calculate the length of any string recursively​
Solnce55 [7]

Answer:

b

Explanation:

6 0
2 years ago
How should I do it Please code for Java
andrew-mc [135]

Answer:

class Main {  

 public static void printPattern( int count, int... arr) {

     for (int i : arr) {

       for(int j=0; j<count; j++)

           System.out.printf("%d ", i);

       System.out.println();

     }

     System.out.println("------------------");

 }

 public static void main(String args[]) {

   printPattern(4, 1,2,4);

   printPattern(4, 2,3,4);

   printPattern(5, 5,4,3);

 }

}

Explanation:

Above is a compact implementation.

3 0
3 years ago
Write a program that prompts the user for two numbers then outputs the result of dividing the first number by the second number
Rainbow [258]

The program is

num = int(input("Enter Numerator "))

den = int(input("Enter Denominator "))

print("quotient is ",str(num//den)," remainder is ", str(num%den))

<h3>How to create a division sign in HTML?</h3>

To create a division sign ( ÷ ) in HTML you can use any of the following codes.

&divide;

&div;

&#247;

<h3>How to divide in computer programming?</h3>

Perl code

use strict;

my $first = 15;

my $second = 5;

my $answer = $first / $second;

print "You get $answer if you divide $first by $second";

When the script above is run, it displays "You get 3 if you divide 15 by 5" on the screen.

To learn more about programming, refer

https://brainly.ph/question/4743

#SPJ4

5 0
1 year ago
Hello! I am a new coder, so this is a simple question. But I am trying to create a code where you enter a number, then another n
slavikrds [6]

no longer returns an error but your math seems to have something wrong with it, always returns 0

Console.WriteLine("Enter a percentage here");

   int Percent = int.Parse(Console.ReadLine());

   Console.WriteLine("Enter your number here");

   int Number = int.Parse(Console.ReadLine());

   int result = Percent / 100 * Number;

6 0
2 years ago
Create a list words = ['is', 'NLP', 'fun', '?']. Use a series of assignment statements (e.g. words[1] = words[2]) and a temporar
Svetlanka [38]

Answer:

words = ['is', 'NLP', 'fun', '?']

tmp = words[1]

words[1] = words[0]

words[0] = tmp

words[3] = '!'

print(words)

Explanation:

- Create the list

- Assign the new values using <em>tmp</em> variable

- Print the result

Since tuples in Python are unchangeable, you cannot transform the list using tuple assignment.

5 0
3 years ago
Other questions:
  • Based on the current economic situation do you expect the employment demand for graduating engineers to increase or decrease? Ex
    9·1 answer
  • An application programming interface (API) is: Group of answer choices the code the application software needs in order to inter
    9·1 answer
  • The best defenses against covert channels include IDS and intrusion prevention system (IPS) and thoroughly watching all aspects
    15·1 answer
  • How has science fiction influenced technology
    7·2 answers
  • You have a site (Site1) that has about 20 users. For the last few months, users at Site1 have been complaining about the perform
    9·1 answer
  • How to solve a program that accepts a number as input and prints just the decimal portion
    15·2 answers
  • Provide a few examples of how cryptography actually secures data.
    8·1 answer
  • 8.10 quiz edhesive A swap is: a variable used to find the smallest value in an array an algorithm used to find a value in an arr
    12·1 answer
  • 2.2 Write an interactive C# program that asks the user to input an integer number. The program checks whether the number entered
    10·1 answer
  • Uh can somebody help me
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!