For loop with subs
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi All,
I have been trying to to have three different matrix based on the values of y , z, however, it's strange, the output matrix of mat is not 1*3 its 4*9 ?
Why can not I have three different matrices (1*3)?
syms l1 l2 real;
x=[2,3,4];
mat=[1 2 3;l1 2 l1];
mat=subs(mat,{l2})
for i=1:3
y=x(i)+1;
z=[1 2 3;4 5 y];
subs(mat,{l1,l2},{y,z})
end
2 Commenti
Walter Roberson
il 14 Lug 2019
Why would you expect the result of substituting into a 2 x 3 matrix to ever be smaller than 2 x 3?
Risposte (1)
TADA
il 14 Lug 2019
You are setting a 2x3 matrix into l2, which duplicates mat for all possible substitutions
2x3 times 2x3 = 4x9
0 Commenti
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!