cell配列内でのpolyfitの使い方について
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
1×5のcellがあり、その中にそれぞれx行2列のデータが入っています。
xはcellごとにサイズが異なります。
polyfitを使用してそれぞれのcellに格納されている行列に対して、近似直線の傾きと切片を得たいのです。
出力としては1×5のcellでそれぞれに傾きと切片が入っているイメージです。
cellfunを使用するのですが、x行2列を入力引数に入れる書き方が分からずうまくいきません。
どなたかご教示ください。
0 Kommentare
Antworten (1)
Atsushi Ueno
am 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、それぞれに傾きと切片
Siehe auch
Kategorien
Mehr zu Image Processing and Computer Vision 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!