Badly conditioned equations - how can I centre and scale properly
31 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
A Poyser
am 21 Nov. 2023
Kommentiert: A Poyser
am 22 Nov. 2023
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 Kommentare
Akzeptierte Antwort
Torsten
am 21 Nov. 2023
Bearbeitet: Torsten
am 21 Nov. 2023
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!