solve command

1 vue (au cours des 30 derniers jours)
mahdi
mahdi le 1 Mai 2012
Dear all, i have problem with solve command, this is my program:
H=[1 2 3; 4 5 6; 7 8 9]
S=[11 22 33; 44 55 66 ;77 88 99]
syms e11 e12 e13 e21 e22 e23 e31 e32 e33
E=[e11 e12 e13;e21 e22 e23;e31 e32 e33]
HMES=H-E*S
DE=solve('HMES(1,1)','HMES(1,2)','HMES(1,3)','HMES(2,1)','HMES(2,2)','HMES(2,3)','HMES(3,1)','HMES(3,2)','HMES(3,3)')
EI(1,1)=DE.e11;
EI(1,2)=DE.e12;
EI(1,3)=DE.e13;
EI(2,1)=DE.e21;
EI(2,2)=DE.e22;
EI(2,3)=DE.e23;
EI(3,1)=DE.e11;
EI(3,2)=DE.e12;
EI(3,3)=DE.e13;
this is Error:
??? Error using ==> subsref
Reference to non-existent field 'e11'.
Error in ==> sym.subsref at 16
y = builtin('subsref',struct(x),a);
Error in ==> Un55555titled at 11
EI(1,1)=DE.e11;
????

Réponses (2)

Taniadi
Taniadi le 3 Mai 2012
Are you trying to solve a system of linear equations? I found difficulties in using solve. If you want to solve linear equations numerically (and using a number), why don't you try to solve using fsolve or using matrix operations? I think that is easier.

Walter Roberson
Walter Roberson le 3 Mai 2012
Remove the quotes.
DE = solve(HMES(1,1), HMES(1,2), HMES(1,3), HMES(2,1), HMES(2,2), HMES(2,3), HMES(3,1), HMES(3,2), HMES(3,3));

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by