Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Messin with Matrices | Coding Foundations
Matlab Basics

bookMessin with Matrices

Swipe to show menu

Matrix operations are the base by which we manipulate numbers and data in Matlab. This chapter serves as a one-stop reference for a wide range of fundamental syntax as you get familiar. Explore the examples and play with your own, use the snippet as a quick reference when you're programming, and before long this will all be second nature.

Task

Write a program that:

  • Defines the following two matrices as variables:
A=[21173110122.54783โˆ’18211โˆ’4297117]B=[123โˆ’5146190213672143757โˆ’157]A = \begin{bmatrix} 21 & 17 & 31\\ 101 & 22.5 & 47\\ 83 & -18 & 211\\ -42 & 97 & 117 \end{bmatrix} \qquad B= \begin{bmatrix} 123 & -51 & 46\\ 19 & 0 & 2\\ 13 & 67 & 214\\ 37 & 57 & -157 \end{bmatrix}
  • Calculates the component-wise product of A and B;
  • Calculates the component-wise square of matrix A;
  • Calculates the component-wise square root of the sum A + B;
  • Calculates the average values of each of the columns of B;
  • Calculates the sum of each of the rows of A;
  • Calculates the sum of all the entries of B;
  • Creates a new matrix in which the third row of A is replaced with that of B;
  • Calculates the maximum value of the average values of the rows of A;
  • Creates a new matrix containing just rows 2-4 and columns 2-3 of B.
Everything was clear?

How can we improve it?

Thanks for your feedback!

Sectionย 2. Chapterย 1

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Sectionย 2. Chapterย 1
some-alt