フィルターのクリア

How can I insert the value of a symbol in symbolic matrix and convert it into a numerical matrix?

19 ビュー (過去 30 日間)
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

回答 (2 件)

David Hill
David Hill 2019 年 12 月 7 日
t=1;
subs(GRAM);

Star Strider
Star Strider 2019 年 12 月 7 日
Please see Plotting error: Need to plot the evolution of symbolic matrix? to convert it to a numerical matrix (as an anonymous function).
  4 件のコメント
Shauvik Das
Shauvik Das 2019 年 12 月 7 日
It does not help.
Code:
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
%% Now I want replace t=1 for the matrix Gram??
Star Strider
Star Strider 2019 年 12 月 7 日
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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by