Warning: Polynomial is badly conditioned. Add points with distinct X values, reduce the degree of the polynomial, or try centering and scaling as described in HELP POLYFIT.
10 次查看(过去 30 天)
显示 更早的评论
syms x
Bic=1.55;
interbiot=load('datosbiot.txt');%creacion de polinomio interpolador de costantes lamda y A
x11=interbiot(:,1);%lamda
y11=interbiot(:,4);
x21=interbiot(:,1);%A
y21=interbiot(:,5);
w=polyfit(x11,y11,28);
w1=polyfit(x21,y21,28);
f11=@(x)w(1)*x^28 + w(2)*x^27 + w(3)*x^26 + w(4)*x^25 + w(5)*x^24 + w(6)*x^23 + w(7)*x^22 + w(8)*x^21 + w(9)*x^20 + w(10)*x^19 + w(11)*x^18 + w(12)*x^17 + w(13)*x^16 + w(14)*x^15 + w(15)*x^14 + w(16)*x^13 + w(17)*x^12 + w(18)*x^11 + w(19)*x^10 + w(20)*x^9 + w(21)*x^8 + w(22)*x^7 + w(23)*x^6 + w(24)*x^5 + w(25)*x^4 + w(26)*x^3 + w(27)*x^2 + w(28)*x + w(29);
f21=@(x)w1(1)*x^28 + w1(2)*x^27 + w1(3)*x^26 + w1(4)*x^25 + w1(5)*x^24 + w1(6)*x^23 + w1(7)*x^22 + w1(8)*x^21 + w1(9)*x^20 + w1(10)*x^19 + w1(11)*x^18 + w1(12)*x^17 + w1(13)*x^16 + w1(14)*x^15 + w1(15)*x^14 + w1(16)*x^13 + w1(17)*x^12 + w1(18)*x^11 + w1(19)*x^10 + w1(20)*x^9 + w1(21)*x^8 + w1(22)*x^7 + w1(23)*x^6 + w1(24)*x^5 + w1(25)*x^4 + w1(26)*x^3 + w1(27)*x^2 + w1(28)*x + w1(29);
lamc=feval(f11,Bic);
Ac=feval(f21,Bic);
Hola, estoy intentando crear un polinomio interpolador con un set de datos que contiene 29 pares ordenados, por lo que mi grado de polinomio es 28. Si evalúo el polinomio en los pares ingresados el resultado es correcto, pero si intento interpolar un valor distinto me muestra resultados negativos o erróneos. Por favor, me podrían explicar como lograr hacer un polinomio interpolador con los 29 pares ordenados. Gracias
0 个评论
回答(1 个)
Akash
2024-2-16
Hi Jafet,
The warning message encountered for "polyfit" indicates that the polynomial fit is poorly conditioned, which is a common issue with high-degree polynomials, when the rank of the Vandermonde matrix for 'x' is not being full, leading to numerical instability and imprecise interpolation results.
To address this issue, you might consider either reducing the degree of the polynomial or adopting alternative interpolation methods. "Spline" interpolation, for instance, could provide more stable outcomes for data sets of this magnitude. The "spline" interpolation technique can be implemented using the "interp1" function for 1-D data interpolation, specifying the "spline" method.
For more information about using 1-D data interpolation with different interpolation method, you can utilize the below provided documentation link:-
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!