How do you do matrix math?

Hey all,
How can you develop a 3 x 3 matrix with elements ranging from 1 to 9. Then perform the calculation that Add 40 to it, divide element-wise by 7, subtract 2 from it, take the square root of the result then take the exponential of that. Do all thismath in one line of code.

댓글 수: 6

James Tursa
James Tursa 2020년 9월 15일
What have you done so far? What specific problems are you having with your code?
Walter Roberson
Walter Roberson 2020년 9월 15일
See also magic()
I have done this so far but I am stuck
d =[1 2 3; 4 5 6; 7 8 9]
d+(40)(./7)-2
KSSV
KSSV 2020년 9월 15일
Read about BODMAS rules..
d =[1 2 3; 4 5 6; 7 8 9]
(d+40)/7-2
Nicholas Deosaran
Nicholas Deosaran 2020년 9월 15일
Thank you,
I am stuck on the part on how to take the square root of that then that the expoential of it..

답변 (1개)

KSSV
KSSV 2020년 9월 15일

0 개 추천

Read about exp, sqrt. If A is my matrix, to get exp of sqrt, I will use.
iwant = exp(sqrt(A)) ;

이 질문은 마감되었습니다.

태그

질문:

2020년 9월 15일

마감:

2021년 8월 20일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by