Filter löschen
Filter löschen

Calculate roots of equations

1 Ansicht (letzte 30 Tage)
Max
Max am 17 Nov. 2012
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

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 17 Nov. 2012
Bearbeitet: Azzi Abdelmalek am 17 Nov. 2012
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))'

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by