Curve fitting tool fits a wrong equation

조회 수: 2(최근 30일)
Elizaveta Iavorskaia
Elizaveta Iavorskaia 2022년 11월 28일
댓글: Matt J 2022년 11월 28일
I am using Matlab for my physical chemistry lab evaluation. Currently I am trying to fit an equation , using the custom equation function. When I fit it works fine, but as soon as I add a second parameter, the fit bocomes linear and I can't figure out why.
  댓글 수: 3
the cyclist
the cyclist 2022년 11월 28일
Also, I don't think this should matter, but just to be absolutely certain, I would try coding the equation as
(a./x) + b

댓글을 달려면 로그인하십시오.

채택된 답변

the cyclist
the cyclist 2022년 11월 28일
I can't figure out what is going wrong here, and I don't have the Curve Fitting Toolbox to play around.
I get a sensible fit using fitnlm, so if you have the Statistics and Machine Learning Toolbox, you could use that if you don't figure this out.
% The data
p = [101500, 77300, 61600, 51300, 45000, 39000]';
V = [0.03, 0.04, 0.05, 0.06, 0.07, 0.08]';
% Define function that will be used to fit data
% (F is a vector of fitting parameters)
f = @(F,x) F(1)./x + F(2);
% Define starting guess of coefficients
beta0 = [1000 1];
% Fit the model
mdl = fitnlm(p,V,f,beta0);
% Plot the data and fit
  댓글 수: 3
Matt J
Matt J 2022년 11월 28일
To get a better starting guess:

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by