How to assign a symbolic equation to previously defined numeric matrix?
Afficher commentaires plus anciens
I have a vector that at the first stage it contains numeric values, but later must be assigned by symbolic equations. How is it possible in Matlab?
As a short example:
clear
syms eta__2 zeta__2
Wxy2(1)=1;
Wxy2(1) = legendreP(1, zeta__2)*legendreP(1, eta__2) ;
5 commentaires
Torsten
le 18 Sep 2022
I have a vector that at the first stage it contains numeric values, but later must be assigned by symbolic equations.
I understand if a variable is first symbolic and then is converted to numeric type, but the other way round makes no sense to me.
Maybe you could explain in more detail what your question is about.
Torsten
le 18 Sep 2022
Wxy(r) on the right-hand side of
Wxy2(r) =legendreP(i, zeta__2)*legendreP(j, eta__2) + Wxy2(r);
is not defined.
You must initialize it somewhere as a symbolic array and assign symbolic values to its three elements.
syms eta__2 zeta__2
Wxy2 = sym('Wxy2',[1 3]);
Wxy2(1:3) = sym('0');
for r=1:3
for i=1:11
for j=1:11
Wxy2(r) =legendreP(i, zeta__2)*legendreP(j, eta__2) + Wxy2(r);
end
end
end
Wxy2
Réponses (0)
Catégories
En savoir plus sur Assumptions dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
