Hello!
I have extracted data from experiments and need to fit a function for them. The parameters to be fit change with time, but the idea is to keep them constant for each fit. In order to do that, I take 5 points at a time from the experimental data and fit the function for it.
At the beginning, my equation was as follows and I only had the 'x' variable taken from the experimental data. G and eta_v are the parameters I wanted to fit in order to find the function y:
y = ((0.0047 – (eta_v +0.0047)*(eta_v/G))*exp(-G*x/eta_v)+(eta_v+0.0047)*eta_v/G)
I am using the fittype function with Nonlinear Least Squares method for the fitting. This was pretty easy, as soon as the fitting is done, I get the next 5 points for x and do the fitting again. I always want to plot the values of G and eta_v as a function of x.
The problem is that now I removed some hypotheses, and there are a few more variables that I need to use. They are shown in the equation below as 'w' and 'z'. I extract them from the experiments as well. The idea is the same as above, to find the values of eta_v and G that fit y from the experimental data. However, I am having a hard time to write it in my code, and for plotting afterwars I only need y, G and eta_v as a function of 'x' (just like in the equation above), so it is a linear plot that I already know how to make.
y = ((eta_v + 0.0047)*(z + eta_v*0.0047/((eta_v + 0.0047)*G)*w)+(0.0047*z – (eta_v + 0.0047)*(z + eta_v*0.0047/((eta_v + 0.0047)*G)*w))*exp(-G*x/eta_v))
Can someone shed some light into how I can perform this fitting, please? I cannot put the values of 'w' and 'z' directly in the equation because they change from each fitting.
Thanks!
Best Answer