Badly conditioned equations - how can I centre and scale properly
조회 수: 25 (최근 30일)
이전 댓글 표시
After writing my own best fit line. I can see that the results are pretty great, however the equation is apparantly badly scaled.
%
alumina_610 = [
25 90
1200 120
1300 150
1350 310
1400 450
1500 790 ];
%%
% % Nextel 610
figure1 = figure;
%
hold on
%
x = (alumina_610(:,1));
y = (alumina_610(:,2));
[xData, yData] = prepareCurveData( x, y );
% Set up fittype and options.
ft = fittype( {'x^12', '100'}, 'independent', 'x', 'dependent', 'y', 'coefficients', {'a', 'b'} );
%
[fitresult, gof] = fit( xData, yData, ft );
% plot fit:
x_fit = linspace(1,1600,100);
y_fit = fitresult(x_fit);
plot(x_fit,y_fit,':r')
% Label axes
xlabel( 'x', 'Interpreter','latex' );
ylabel( 'y', 'Interpreter','latex' );
plot(alumina_610(:,1),alumina_610(:,2),'ro', ...
'MarkerFaceColor','r')
ylim([0 900])
ylabel('Grainsize [nm]','Color',[ 0 0 0 ])
xlim([0 1600])
%
xlabel('Temperature$^{o}$C', 'Interpreter','latex')
% % %
%
How do I correctly scale a best fit line?
Thanks in advance
댓글 수: 0
채택된 답변
Torsten
2023년 11월 21일
편집: Torsten
2023년 11월 21일
Your problem is linear, but fitting data with an independent coordinate up to 1500 by a polynomial of degree 12 is nonsense.
alumina_610 = [
25 90
1200 120
1300 150
1350 310
1400 450
1500 790 ];
M = [alumina_610(:,1).^12 1e38*ones(size(alumina_610,1),1)];
rank(M)
b = alumina_610(:,2);
p = M\b
hold on
plot(alumina_610(:,1),alumina_610(:,2),'o')
x = linspace(alumina_610(1,1),alumina_610(end,1),100);
plot(x,p(1)*x.^12+p(2)*1e38)
hold off
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!