solve command

1 次查看(过去 30 天)
mahdi
mahdi 2012-5-1
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;
????

回答(2 个)

Taniadi
Taniadi 2012-5-3
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 2012-5-3
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));

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by