首页 > 编程学习 > matlab中solve解方程,MATLAB中使用solve解决方程组的问题

希望使用MATLAB的solve函数解出一个带有虚数的方程组,但是一直提示计算错误,要么就是算不出来结果,希望大佬们能帮帮忙

程序如下:

syms a1 a2;

a=[a1 a2];

C11=3.0638; C16=0; C66=0.43; C12=0.2553; C26=0; C22=1.0213;

Q=[C11 C16

C16 C66];

R=[C16 C12

C66 C26];

T=[C66 C26

C26 C22];

p =[0.0000 + 2.4443i 0.0000 - 2.4443i;

0.0000 + 0.7086i 0.0000 - 0.7086i];

NN=Q+p*(R+R')+p.^2*T;

NNN=NN*a';

[a1,a2]=solve('NNN(1,1)=0','NNN(2,1)=0');

将整个程序中有关部分抽出来大体就是这样

其中

NNN(1,1)=conj(a1)*(278503124105983/562949953421312 - (3771942107230111*i)/2251799813685248) + conj(a2)*(- 6870085320353951/1125899906842624 + (3771942107230111*i)/2251799813685248)

NNN(2,1)=conj(a1)*(- 3889470818224061/18014398509481984 - (2186964101937779*i)/4503599627370496) + conj(a2)*(- 1491754098253525/18014398509481984 + (2186964101937779*i)/4503599627370496)

目标是让这两个方程组均为0从而解出a1与a2

而最终的结果却是:

警告: 2 equations in 0 variables.

> In E:\Program Files\MATLAB\R2014a\toolbox\symbolic\symbolic\symengine.p>symengine at 56

In mupadengine.mupadengine>mupadengine.evalin at 97

In mupadengine.mupadengine>mupadengine.feval at 150

In solve at 170

In xuanbiliang1 at 30

错误使用 mupadengine/feval (line 157)

MuPAD error: Error: A variable to solve for is required. [solve]

出错 solve (line 170)

sol = eng.feval('symobj::solvefull',eqns,vars);

出错 xuanbiliang1 (line 30)

[a1,a2]=solve('NNN(1,1)=0','NNN(2,1)=0 操作');

求大佬帮忙看看是什么原因,拜谢:'(

Copyright © 2010-2022 ngui.cc 版权所有 |关于我们| 联系方式| 豫B2-20100000