How to create a matrix from other matrixes

1 Ansicht (letzte 30 Tage)
Jaime Rodriguez Mielgo
Jaime Rodriguez Mielgo am 24 Sep. 2020
Beantwortet: madhan ravi am 24 Sep. 2020
So my teacher made this exercise on class earlier this week where you have to build a matrix only using other matrix and vector. I dont really understand it and since i have online clases im having a lot of trouble trying to get an answer from the teacher. Here is the code:
rng(1);
A=randi(10,[4 6]);
v=randi(10,[1 8]);
M = [[v(1,1:4); [A(1:3,1:3) A(1:3,4)]; A(:,4)'] [2;v(1,5:8)']]
I have this as answer:
M =
9 9 1 1 2
5 2 4 3 2
8 1 6 9 9
1 2 5 1 1
3 9 1 7 5
I understand that you use only certain parts of each of M and v(for example v(1, 1:4)). What i dont understand is the order you have to follow to create the matrix M because as its written I understand it as: First line of M is part of the vector v, then second line is part of (what does that mean?) of A, and then last line is a part of A again. And then, in the next bit of code you define a new column??
Thanks in advance

Akzeptierte Antwort

madhan ravi
madhan ravi am 24 Sep. 2020
I undertand your pain of online classes brother. Have a read:
Take part in MATLAB On-ramp as well , will make things easier for you.

Weitere Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by