フィルターのクリア

Calculate roots of equations

1 回表示 (過去 30 日間)
Max
Max 2012 年 11 月 17 日
Hi at all, (firtsly sorry for bad english, probably I'll use the wrong word).
I have a matrix in which I have memorized the coefficients of polynomials:
A=[2 2 ; 3 3 ; ... ... ...]
every row rapresents a polynomial:
A1 -> A(1,:) -> 2x + 2
A2 -> A(2,:) -> 3x + 3
An...
to resolve the equation A1=0
ax + b = 0
x= - (b/a)
I do:
xA1 = - ( A(:,1) / A(:,2) );
I do it for all n rows.
Computionally this way is too expensive;
My questions are:
1. there is a command that calculates the roots of a generic equation?
2. If that command exists, Can I apply it ( with a for-cycle ) to every equations ?
If I'm not clear, please ask me... thanks

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 11 月 17 日
編集済み: Azzi Abdelmalek 2012 年 11 月 17 日
use roots function
example
A=[1 2 1; 4 5 8; 8 9 7]
sol=cell2mat(arrayfun(@(x) roots(A(x,:)),(1:size(A,1)),'un',0))'

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by