如何在matlab中找到方程的关键点?

时间:2014-12-22 05:38:19

标签: matlab equation equation-solving

在matlab中,我们使用meshgrid而不是双重for循环来提高速度,尤其是当迭代次数很多时。

在我的应用程序中,我使用meshgrid来查找矩阵的临界点。

syms x
a=0.1:5
b=0.1:5
[A,B]=meshgrid(a,b)
y=A*x^2+B*x+B
y_deriv=diff(y,x)
solution=solve(y_deriv==0,x)

然而,它给了我

Warning: 25 equations in 1 variables. 
> In C:\Program Files\MATLAB\R2013b\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 
Warning: Explicit solution could not be found. 
> In solve at 179 

solution =

[ empty sym ]

我打算做的是:

solve(y_deriv(1)==0,x)

solve(y_deriv(2)==0,x)

......等等。

我可以循环播放,但我不想这样做。在matlab中是否有任何逐元素的解决操作?


更新

我认为y_deriv给了我:

[ x/5 + 1/10,  (11*x)/5 + 1/10,  (21*x)/5 + 1/10,  (31*x)/5 + 1/10,  (41*x)/5 + 1/10]
[ x/5 + 11/10, (11*x)/5 + 11/10, (21*x)/5 + 11/10, (31*x)/5 + 11/10, (41*x)/5 + 11/10]
[ x/5 + 21/10, (11*x)/5 + 21/10, (21*x)/5 + 21/10, (31*x)/5 + 21/10, (41*x)/5 + 21/10]
[ x/5 + 31/10, (11*x)/5 + 31/10, (21*x)/5 + 31/10, (31*x)/5 + 31/10, (41*x)/5 + 31/10]
[ x/5 + 41/10, (11*x)/5 + 41/10, (21*x)/5 + 41/10, (31*x)/5 + 41/10, (41*x)/5 + 41/10]

我想要的是解决矩阵中所有元素的x/5+1/10==0x/5+11/10==0x/5+21/10==0,...等等。

0 个答案:

没有答案