Make a larger matrix from smaller ones

1 次查看(过去 30 天)
what I am trying to do in matlab is making a matrix from 2 smaller ones in a specific order
consider we have 2 matrices 2*2 called A and B. where k1 and k2 are constants
k1 = 50 k2 = 100
A = [k1 -k1; -k1 k1] B = [k2 -k2; -k2 k2]
now i want it to look like this in a larger matrix
C = [k1 -k1 0; -k1 k1+k2 -k2;0 -k2 k2]
is this possiple to do in matlab? this is just an simple example but i genarelly works with much larger matrixes with the same order.
thanks in advance :-)
  6 个评论
Ahmad El-Kassem
Ahmad El-Kassem 2017-3-10
编辑:Ahmad El-Kassem 2017-3-10
Yes i am trying to do an addition of translated matrices but just on a larger scale. I saw my teacher make a loop to solve this
ps. i Forgot that the Forum.m is a special case that is not interested in this topic. Sorry :-)
David Goodmanson
David Goodmanson 2017-3-11
Hi Ahmad, If you are saying that this website is not interested in this kind of problem, then that is not true. The initial comments above were about understanding the nature of the problem, not with the problem itself. People get assistance on indexing problems similar to this all the time. The only consideration is that the person asking the question has defined the issue, made an effort to solve it, and usually has supplied some code that does not work yet.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by