I'm not sure that is not possible to use a simple
fit function. I try to explain my idea, tell me if I am wrong.
You have to find a fit function that depends on two variables (beta1 and beta2). y= 0.1424*(1+beta(1)*x+beta(2)*x.^2)
You have a constraint: the fitting curve have to pass through a specific point (let's name it (xc yc)). This give you a condition on beta1 and beta2:
yc= 0.1424*(1+beta(1)*xc+beta(2)*xc.^2)
0.1424=0.1424*(1+beta(1)*(-0.0076)+beta(2)*(-0.0076).^2)
so you can write beta1 as function of beta2. I try to compute manually (but probably I'm wrong) and I found: beta1=-xc*beta2.
So, now, the initial function become:
y= 0.1424*(1+(0.0076*beta2)*x+beta2*x.^2)
You can use the fittype function to tell to matlab what is the function for fitting:
f = fittype('0.1424*(1+(0.0076*beta1)*x+(beta1)*x^2)');
it recognize by itself that beta1 is the free parameter and x the independent variable.
Now, let's fit...
[c2,gof2] = fit(xdata,ydata,f);
and plot...
figure()
plot(xdata,ydata,'*')
hold on
plot(c2)
I resume all the code:
xdata= [-4.22; -3.64; -3.35; -2.79; -0.0076; 1.71];
ydata= [0.34; 0.28; 0.26; 0.25; 0.1424; 0.137];
f = fittype('0.1424*(1+(0.0076*beta1)*x+(beta1)*x^2)');
[c2,gof2] = fit(xdata,ydata,f);
figure()
plot(xdata,ydata,'*')
hold on
plot(c2)
It runs and it gives me a good result. I hope it is what you want.