Fit data to a hill equation using lsqnonlin

17 views (last 30 days)
Hi guys,
I'm trying to fit some data to a hill equation. My X-Axis:
Agonist = [0.1 0.5 1 5 10 19 50 100 114 500 1000 2000];
My Y-Axis:
atRA = [0 0 7 15 30 50 58 80 83 87 90 90];
My function:
function [F] = hill_fit(x,Emax,EC50)
num = Emax*x;
denom = EC50+x
F = num./denom
end
My fitting code:
EMax = 90;
EC50 = 19;
x = lsqnonlin(@hill_fit,Agonist,Emax,EC50,atRA);
However this gives me a shed load of warmings so I don't think its doing what I want it to. In essence all I want to do is fit the data to the hill equation, can anybody help?
Thanks

Accepted Answer

Star Strider
Star Strider on 11 Apr 2015
I don’t recognise this particular Hill equation (there are several), but that aside, estimating your parameters and plotting them is relatively straightforward:
Agonist = [0.1 0.5 1 5 10 19 50 100 114 500 1000 2000];
atRA = [0 0 7 15 30 50 58 80 83 87 90 90];
% MAPPING: Emax = b(1), EC50 = b(2)
hill_fit = @(b,x) b(1).*x./(b(2)+x);
b0 = [90; 19]; % Initial Parameter Estimates
B = lsqcurvefit(hill_fit, b0, Agonist, atRA);
AgVct = linspace(min(Agonist), max(Agonist)); % Plot Finer Resolution
figure(1)
plot(Agonist, atRA, 'bp')
hold on
plot(AgVct, hill_fit(B,AgVct), '-r')
hold off
grid
xlabel('Agonist')
ylabel('atRA')
legend('Data', 'Hill Equation Fit', 'Location','SE')
If you’re doing curve-fitting, it’s easiest to use the lsqcurvefit function. It uses lsqnonlin but is specifically designed to make curve-fitting straightforward.

More Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!