how can i return l21 value
Ältere Kommentare anzeigen
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
Antworten (1)
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
Kategorien
Mehr zu Numbers and Precision finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



