Assigning values to defined symbolic variables afterwards

syms x ar la
C_I=[((1+(4/3)*ar*sin(x))/8)*la,0,0,0;0,((1-(4/3)*ar*cos(x))/8)*la,0,0; 0,0,((1-(4/3)*ar*sin(x))/8)*la,0; 0,0,0,((1+(4/3)*ar*cos(x))/8)*la];
Lb=[1,-1,cos(x),sin(x);1,1,sin(x),-cos(x);1,-1,-cos(x),-sin(x);1,1,-sin(x),cos(x)];
Lb_1=inv(Lb);
Cm=Lb_1*(2*(diff(Lb,x))+(C_I*Lb));
How can you calculate the Cm matris while x=0 ? What code should I write next?

 Akzeptierte Antwort

Use the subs funciton (and optionally simplify).
Try this —
syms x ar la
sympref('AbbreviateOutput',false);
C_I=[((1+(4/3)*ar*sin(x))/8)*la,0,0,0;0,((1-(4/3)*ar*cos(x))/8)*la,0,0; 0,0,((1-(4/3)*ar*sin(x))/8)*la,0; 0,0,0,((1+(4/3)*ar*cos(x))/8)*la]
C_I = 
Lb=[1,-1,cos(x),sin(x);1,1,sin(x),-cos(x);1,-1,-cos(x),-sin(x);1,1,-sin(x),cos(x)]
Lb = 
Lb_1=inv(Lb)
Lb_1 = 
Cm=Lb_1*(2*(diff(Lb,x))+(C_I*Lb))
Cm = 
Cm_x0 = subs(Cm,{x},{0}) % Substitute 0 for 'x'
Cm_x0 = 
Cm_x0 = simplify(Cm_x0, 500) % Simplified
Cm_x0 = 
.

6 Kommentare

thanks
As always, my pleasure!
Alexi
Alexi am 19 Feb. 2022
Bearbeitet: Alexi am 19 Feb. 2022
I have one more question, sir. There is a difference in only one cell (4th row, 2nd column) between the final matrix obtained from the source I refer to and the matrix (cm_x0) that I found by applying the same operations, is it because of the mathematical difficulty? because I do not think that a single error is caused by formulations.( For simplicity, you can take ar and la as 1, their equivalents here are gamma and mu.)
Same difference also in 2nd row, 4th column.
The μ and γ are new.
How are they defined, especially in the context of the other variables?
μ=ar γ=la

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Version

R2019a

Gefragt:

am 19 Feb. 2022

Kommentiert:

am 19 Feb. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by