How can i use roots function with a 100x3 matrix

5 ビュー (過去 30 日間)
Gko K
Gko K 2019 年 3 月 24 日
コメント済み: Gko K 2019 年 3 月 25 日
I have a nx3 matrix. n rows and 3 columns. Every elements in a row are coefficents of a polynomial.
I want to get roots for every row.
After i get roots i want to eleminate nonlogical root and i can get logical root which i need.
Any idea of this?

採用された回答

Guillaume
Guillaume 2019 年 3 月 24 日
result = cellfun(@roots, num2cell(yourmatrix, 2), 'UniformOutput', false)
Will return a nx1 cell array of column vectors which are the roots of every row.
Alternatively, do it with a loop:
result = cell(size(yourmatrix, 1), 1);
for row = 1:size(yourmatrix, 1)
result{row} = roots(yourmatrix(row, :));
end
I have no idea what a logical or nonlogical root is.
  4 件のコメント
Gko K
Gko K 2019 年 3 月 25 日
Thank you i will try that
Gko K
Gko K 2019 年 3 月 25 日
Thank you friend, that works :)

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by