How to plug in values to symbolic variables and update the matrix?

26 views (last 30 days)
Hello,
I am not sure if this is a stupid question but I need some help with plugging in values to variables. I made some matrices with some symbolic variables.
eg:
syms lambda mu
T = [ lambda mu 0 0 0 0;
-mu lambda 0 0 0 0;
0 0 1 0 0 0;
0 0 0 lambda mu 0;
0 0 0 -mu lambda 0;
0 0 0 0 0 1]
and this matrix T is refered in another calculation
P = transpose(T)*k*T
I want to sub in the values for lambda and mu and update values of T and P. I havent had much luck finding a solution.
Regards,

Accepted Answer

VBBV
VBBV on 2 Nov 2020
Edited: VBBV on 2 Nov 2020
%if true
% code
% end
lambda = sym('20');
mu = sym('10');
T = your matrix
k = 1;
P = transpose(T)*k.*T

More Answers (1)

Walter Roberson
Walter Roberson on 2 Nov 2020
subs(P, [lambda, mu], [1.7, 0.4])
use appropriate values ;

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!