solve command

3 views (last 30 days)
mahdi
mahdi on 1 May 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;
????

Answers (2)

Taniadi
Taniadi on 3 May 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 on 3 May 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));

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!