如何在Matlab中简化?

时间:2013-03-28 06:56:07

标签: matlab simplify

我想简化以下操作,但它会产生一个错误,指出:输入参数太多。谁能告诉我我做错了什么???

>> 
syms a b c d e  f g h i j k l x y xy

A=[1 a b a^2 a*b b^2; 1 c d c*2 c*d d^2; 1 e f e^2 e*f f^2; 1 g h g^2 g*h h^2; 1 i j         i^2 i*j j^2; 1 k l k^2 k*l l^2]

B=[1; 0; 0; 0; 0; 0]

A =

[ 1, a, b, a^2, a*b, b^2]
[ 1, c, d, 2*c, c*d, d^2]
[ 1, e, f, e^2, e*f, f^2]
[ 1, g, h, g^2, g*h, h^2]
[ 1, i, j, i^2, i*j, j^2]
[ 1, k, l, k^2, k*l, l^2]


B =

 1
 0
 0
 0
 0
 0

>> simplify(inv(A)*B, 'steps', 100)enter code here

2 个答案:

答案 0 :(得分:0)

我已将您粘贴的代码放在我的matlab(R2013a)副本中,并且完成后没有任何错误。但结果并没有太简化。

如果您的计算机在计算上窒息(很长时间),您可以尝试将这些内容分开,看看是否有帮助。

vec=inv(A)*B
for n=1:6
    results(n)=simplify(vec(n), 'steps', 100);
end
results

答案 1 :(得分:0)

您的电话属于this MATLAB function

但它存在于Symbolic Math Toolbox中,这意味着它只能简化数学公式而不是复杂的矩阵计算。

Simplify Favoring Real Numbers

To force simplify favor real values over complex values, set the value of Criterion to preferReal:

syms x
f = (exp(x + exp(-x*i)/2 - exp(x*i)/2)*i)/2 - (exp(- x - exp(-x*i)/2 + exp(x*i)/2)*i)/2;
simplify(f, 'Criterion','preferReal', 'Steps', 100)
ans =
cos(sin(x))*sinh(x)*i + sin(sin(x))*cosh(x)
If x is a real value, then this form of expression explicitly shows the real and imaginary parts.

Although the result returned by simplify with the default setting for Criterion is shorter, here the complex value is a parameter of the sine function:

simplify(f, 'Steps', 100)
ans =
sin(x*i + sin(x))

相反,我认为您可以尝试使用this function: 简化(f,Steps = numberOfSteps)

但首先,你需要一个'f',可以像递归或迭代函数一样使用。

e.g。 Simplify(sin(x)^2 + cos(x)^2, All)

希望这有帮助!

相关问题