Extracting polynomial coefficients from function handle
古いコメントを表示
I have an unknown large polynomial function handle. for example: f=@(x) 1234*x^2000+654*x^1982+....
I want to extract its coefficients. I know that i Can use a code like this:
%
syms y
coefficients=sym2poly(f(y));
%
but its too slow beacause i need this to repeat in a loop more than 10000 times.
is there any way to extract coefficient directly from function handle???
回答 (1 件)
Andrei Bobrov
2015 年 12 月 30 日
reshape(str2double(regexp(func2str(f),'\d*(?=\*x\^)|(?<=\*x\^)\d*','match')),2,[])'
1 件のコメント
meysam esmaeeli
2015 年 12 月 30 日
カテゴリ
ヘルプ センター および File Exchange で Polynomial Creation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!