How can I insert the value of a symbol in symbolic matrix and convert it into a numerical matrix?
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
Star Strider
am 7 Dez. 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 Kommentare
Star Strider
am 7 Dez. 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.
Siehe auch
Kategorien
Mehr zu Linear Algebra finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!