How to create vector with elements which are matrices?

2 views (last 30 days)
Colleagues! I will try to explain the task in more detail so that it is clear what needs to be done and what you want to have.
It is necessary to find the Green operator through the inversion of some matrix of size NxN, from the main diagonal of which a certain value of energy is subtracted, i.e. Mathcad copes with such a thing one or two times, but I write the program in Matlab due to the limitations of Mathcad's work with RAM.
So, in Mathcad, such a thing is initialized quite easily - the first picture. But I tried to do this in Matlab, and I came across the fact that Matlab does not digest such an array entry.
Then I tried to make a three-dimensional array out of my Green operator (well, or a third-rank tensor, whichever one likes better). It turned out something similar to the truth, but, judging by the calculations, it is not correct - the second picture.
I ask for your help! I have attached Mathcad and Matlab files to this topic in ZIP-format. Thank you in advance!

Answers (1)

Torsten
Torsten on 8 Dec 2023
A cell array might help:
M{1} = [3 5;9 12];
M{2} = [2 -9;0.6 -3.7];
M
M = 1×2 cell array
{2×2 double} {2×2 double}

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!