Process on Matrices (addition, multiplication, ...)
Afficher commentaires plus anciens
how can i define a matricies A and B in MATLAB, there elements are a function of x, as in the following.

Réponses (1)
syms f_11(x) f_12(x) f_21(x) f_22(x) g_11(x) g_12(x) g_21(x) g_22(x)
A = [f_11(x) f_12(x); f_21(x) f_22(x)]
B = [g_11(x) g_12(x); g_21(x) g_22(x)]
If you have sufficiently new MATLAB (R2020b or later I think it is)
clearvars
syms f(t) [2 2]
syms g(t) [2 2]
all_syms = syms();
A = subs(reshape(all_syms(~cellfun(@isempty, regexp(all_syms, '^f\d'))), [2 2]))
B = subs(reshape(all_syms(~cellfun(@isempty, regexp(all_syms, '^g\d'))), [2 2]))
Which is to say that you can automatically construct the indexed functions now, but there is no good way to collect them in a variable.
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!