creating 2 by 2 matrices having 3 entries same in all but 4th one different

1 vue (au cours des 30 derniers jours)
Debasish Mishra
Debasish Mishra le 24 Fév 2020
Réponse apportée : Andy le 24 Fév 2020
i want to create a series of matices m1,m2,m3,m4 etc such that
m1=[1 0; 0 f(x1)]
m2=[1 0;0 f(x2)]
and so on.(only 22 entry is having a functional value and other 3 entries remain same.
x=[x1 x2 x3.....]
f is any arbitrary function.
and i also need to find out how to multiply all the above matrices such that m=m1*m2*m3.......*mn
kindly help

Réponses (1)

Andy
Andy le 24 Fév 2020
Rather than using numbers as part of the variable name use a cell structure
m{1} = [1 0; 0 f(x(1))]
You can then easily use a loop to generate the initial matrices and multiply them.

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by