matlab polyfit multiple sets of y data
조회 수: 7 (최근 30일)
이전 댓글 표시
If I have multiple sets of data (y) under the same x condition, how can I polyfit a fitting line representing these data
If I have multiple y data, how can I use polyfit to get a fitting line about the two y data or what method should I use to get a line representing the two data
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1325995/image.png)
%%
y1 = [10; 20; 30; 40; 50];
y2 = [15; 25; 35; 45; 55];
댓글 수: 1
Dyuman Joshi
2023년 3월 16일
편집: Dyuman Joshi
2023년 3월 16일
How do you get y1, y2, ...? Are they output from some code or are you manual inputting them?
답변 (1개)
KSSV
2023년 3월 16일
Run a loop for each set.....
Let y be your mxn data and x be your 1xn data.
p = cell(m,1) ;
for i = 1:m
p{i} = polyfut(x,y(i,:),2) ;
end
참고 항목
카테고리
Help Center 및 File Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!