- polydern
- polyfitn
- polyn2sym
- polyn2sympoly
- polyvain
Multiple input vector for polyfit and get polyval , derive the best coeff & least RMS Error
2 ビュー (過去 30 日間)
古いコメントを表示
Hi
I have a code which is computing the polyval for multiple input vectors. I would like to derive best coefficient and lowest RMS error
Does MATLAB offer a manner in which I can fit all (x input number) of these simultaneously, where the solution is in the form of a polynomial, and will have some fitted coefficients/best, so that each curve is fit properly?
x1 = rand(12,1); % or replacec with a know data 1:10
x2 = rand(12,1); % or replacec with a know data 2:11
x3 = rand(12,1); % or replacec with a know data 3:12
x4 = rand(12,1); % or replacec with a know data 4:13
x5 = rand(12,1); % or replacec with a know data 5:14
x6 = rand(12,1); % or replacec with a know data 6:15
x7 = rand(12,1); % or replacec with a know data 7:16
x8 = rand(12,1); % or replacec with a know data 8:17
X = [x1,x2,x3,x4,x5,x6,x7,x8];
for n = 1:7
[p,S,mu] = polyfit(X(n),X(n+1),4) % polynomial order [ 2-4]
f(n)= polyval(p,X(n));
plot(X(n),X(n+1),'-o',X(n),f(n),'-+'); hold on;grid on
legend('data','linear fit')
end
0 件のコメント
回答 (1 件)
Rishabh Mishra
2021 年 1 月 7 日
Hi,
Try using the following MATLAB functions for curve fitting & creating polynomials from the given data.
The documentation of above functions is available in MATLAB file exchange. Just type ‘doc functionName’ in your MATLAB console where functionName is any of the above functions.
Feel free to reach out if you are still facing problems while resolving the issue.
1 件のコメント
参考
カテゴリ
Help Center および File Exchange で Interpolation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!