Implizit surface fit of SMA Model; better way possible ?

1 view (last 30 days)
Dear all,
i am using lsqnonlin for this purpose. It works. I would like to know if there is a better way to do that? E.g using the fit function. I tried it but it gave me an error and said that my independent variable x is not used in the equation.
q is z ( Adsorption capacity) Cna is y (Sodium concentration) C is x (inbound Protein ) p are some parameters q0 is the surface charge of the adsorbent; also a parameter FUNCTION defining fitobject:
function q=SMAexplizit(C,Cna,q0,p)
%%solves the SMA model near the point 0.001 and makes an explizit
%%expression for every data point C.
Ke=p(1);
sigma=p(2);
z=p(3);
q=zeros(size(C));
NN=length(C);
opt = optimset('display','off');
for n=1:length(Cna)
for i=1:NN
q(i,n)=fsolve(@(q)Ke*(q0-(z+sigma).*q).^z.*C(i)./(Cna(n).^z)-q,0.001,opt);
end
end
end
MAKE THE FIT:
%%Makes a set of test data
p=[0.2 5.7 9.1]';
q0=635;
Cna=linspace(25,100,4)';
C=linspace(0.01,2,20)';
tic
q=SMAexplizit(p,C,q0,Cna)
toc
tic
Testfit=lsqcurvefit(@(p,C)SMAexplizit(p,C,q0,Cna),p,C,q,[0.001 0.001 1],[100 50 50])
toc

Answers (0)

Categories

Find more on Linear and Nonlinear Regression 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!