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!