フィルターのクリア

Creating and solving a polynomial equal to zero.

4 ビュー (過去 30 日間)
Santos García Rosado
Santos García Rosado 2021 年 4 月 13 日
Hello Mathwork's community,
I'm trying to define as many polynomial functions as columns I have inside an inital matrix A, such as:
A = [-5000 1200 750 2000 1200; -200 150 60 40 50];
Since I have two columns, there'll be two functions that should look like:
Once the polynomial functions have been defiined, I'd like to solve x when the function equals to zero, so that the output for this two cases are:
OutPuts = [0.011369, 0.056055]
I hope I've explained my-self well enough, and that someone could please give me a hand.
Thank's in advance.
Santos

採用された回答

Alan Stevens
Alan Stevens 2021 年 4 月 13 日
Something like this
A = [-5000 1200 750 2000 1200; -200 150 60 40 50];
A = fliplr(A); % Do this in order to use the roots function
R1 = roots(A(1,:)); % roots of first row: 4 values from quartic polynomial
R2 = roots(A(2,:)); % roots of second row: ditto
% R = 1./(1 + x) so x = 1/R - 1
x1 = 1./R1 - 1;
x2 = 1./R2 - 1;
x1(abs(imag(x1))>10^-8)=[]; % delete complex values
x2(abs(imag(x2))>10^-8)=[]; % delete complex values
disp(x1)
disp(x2)
  1 件のコメント
Santos García Rosado
Santos García Rosado 2021 年 4 月 13 日
Thank you Alan! Simple and elegant!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePolynomials についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by