How can I insert the value of a symbol in symbolic matrix and convert it into a numerical matrix?
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
syms t
PHI=[ 1, t, t/3 - (2*exp(-3*t))/9 + 2/9, (2*t)/3 + (2*exp(-3*t))/9 - 2/9;
0, 1, (5*exp(-3*t))/12 - (3*exp(t))/4 + 1/3, 2/3 - exp(t)/4 - (5*exp(-3*t))/12;
0, 0, exp(-3*t)/4 + (3*exp(t))/4, exp(t)/4 - exp(-3*t)/4;
0, 0, (3*exp(t))/4 - (3*exp(-3*t))/4, (3*exp(-3*t))/4 + exp(t)/4];
PHIT=transpose (PHI);
B=[0;1;2;1];
BT=transpose (B);
GRAM = PHI*B*BT*PHIT
%When t=1, Need to find the GRAM matrix
0 commentaires
Réponses (2)
Star Strider
le 7 Déc 2019
Please see Plotting error: Need to plot the evolution of symbolic matrix? to convert it to a numerical matrix (as an anonymous function).
4 commentaires
Star Strider
le 7 Déc 2019
Try this:
PHI = @(t) [ 1, t, t/3-(2*exp(-3*t))/9+2/9, (2*t)/3+(2*exp(-3*t))/9-2/9;
0, 1, (5*exp(-3*t))/12-(3*exp(t))/4+1/3, 2/3-exp(t)/4-(5*exp(-3*t))/12;
0, 0, exp(-3*t)/4+(3*exp(t))/4, exp(t)/4-exp(-3*t)/4;
0, 0, (3*exp(t))/4-(3*exp(-3*t))/4, (3*exp(-3*t))/4+exp(t)/4];
PHIT = @(t) transpose(PHI(t));
B=[0;1;2;1];
BT=transpose(B);
GRAM = @(t) PHI(t)*B*BT*PHIT(t);
calling:
t = 1
GRAM(t)
produces:
t =
1
ans =
6.4744 -6.1142 12.136 12.009
-6.1142 5.774 -11.461 -11.341
12.136 -11.461 22.748 22.51
Make appropriate changes to get different results.
Voir également
Catégories
En savoir plus sur Linear Algebra dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!