- polydern
- polyfitn
- polyn2sym
- polyn2sympoly
- polyvain
Multiple input vector for polyfit and get polyval , derive the best coeff & least RMS Error
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Rishabh Mishra
el 7 de En. de 2021
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 comentario
Life is Wonderful
el 8 de En. de 2021
Editada: Life is Wonderful
el 8 de En. de 2021
Ver también
Categorías
Más información sobre Interpolation en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!