how can i return l21 value
1 view (last 30 days)
Show older comments
i am unable to return the l21 values as it is saved in a string format
here is my code:
syms l21 l31 l32 u11 u12 u13 u22 u23 u33
L=[1 0 0;l21 1 0;l31 l32 1]
U=[u11 u12 u13;0 u22 u23;0 0 u33]
B=L*U
A=[2 -3 1;1 -1 -2;3 1 -1]
x=solve(A==B,[l21,l31,l32,u11,u12,u13,u22,u23,u33])
l21
0 Comments
Answers (1)
Dyuman Joshi
on 14 Mar 2023
As you can see above, l21 is stored as a field in the struct x. You need to use dot indexing to get its value -
syms l21 l31 l32 u11 u12 u13 u22 u23 u33
L=[1 0 0;l21 1 0;l31 l32 1];
U=[u11 u12 u13;0 u22 u23;0 0 u33];
B=L*U;
A=[2 -3 1;1 -1 -2;3 1 -1];
x=solve(A==B,[l21,l31,l32,u11,u12,u13,u22,u23,u33])
%Accessing field values via dot indexing
x.l21
x.u11
0 Comments
See Also
Categories
Find more on Data Type Identification 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!