簡體   English   中英

在MATLAB中求解符號方程

[英]Solving symbolic equation in matlab

我正在嘗試求解以下形式的符號方程

D = lamda^12/339288145381785600000 + lamda^10/18124366740480000 +
    lamda^8/7846046208000 + lamda^6/523908000 + lamda^4/25200

其中lamda被聲明為sym 我得到的輸出不是可讀形式。 甚至vpa也不以可讀的形式給我答案。 有什么解決方案?

首先我們定義符號函數:

syms x
f(x) = x^12/339288145381785600000 + x^10/18124366740480000 + ...
    x^8/7846046208000 + x^6/523908000 + x^4/25200;
ezplot(f)

方程function_plot

接下來,我們找到根(通過數值求解)。 您還可以使用vpasolve MATLAB函數:

sol = feval(symengine, 'numeric::solve', f==0, x)

有1個實際解決方案和8個復雜的解決方案:

>> sol(:)
sol =
   79.624598247213536847657202795915 - 49.037140566365604310129811798328*i
   79.624598247213536847657202795915 + 49.037140566365604310129811798328*i
                                       118.88396448746822093664197370373*i
                                      -118.88396448746822093664197370373*i
                                      -111.61305465738189638915837157361*i
                                       111.61305465738189638915837157361*i
                                                                         0
 - 79.624598247213536847657202795915 - 49.037140566365604310129811798328*i
 - 79.624598247213536847657202795915 + 49.037140566365604310129811798328*i

最后,我們繪制根源:

s = double(sol);
plot(real(s), imag(s), 'r.', 'MarkerSize',25)
axis square; axis([-100 100 -150 150]); box on
line(xlim(), [0 0], 'Color','k', 'LineStyle',':')
line([0 0], ylim(), 'Color','k', 'LineStyle',':')
xlabel('Re(x)'), ylabel('Im(x)'), title('Roots in Complex Plane')

roots_complex_plane

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM