cell配列内でのpolyfitの使い方について
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
1×5のcellがあり、その中にそれぞれx行2列のデータが入っています。
xはcellごとにサイズが異なります。
polyfitを使用してそれぞれのcellに格納されている行列に対して、近似直線の傾きと切片を得たいのです。
出力としては1×5のcellでそれぞれに傾きと切片が入っているイメージです。
cellfunを使用するのですが、x行2列を入力引数に入れる書き方が分からずうまくいきません。
どなたかご教示ください。
0 commentaires
Réponses (1)
Atsushi Ueno
le 9 Mai 2023
C = cell(1,5); % 1×5のcell
C = cellfun(@(x) rand(randi(10),2),C,'uni',false) % それぞれx行2列のデータ
cellfun(@(x) polyfit(x(:,1),x(:,2),1),C,'uni',false) % 1×5のcell、それぞれに傾きと切片
Voir également
Catégories
En savoir plus sur Image Processing and Computer Vision dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!