Asked by Kelly McGuire
on 11 Apr 2017

So, I am trying to perform a global fit on 15 data traces obtained from electrophysiology. The first three traces had a concentration of 10 micromolar, the second three traces had a concentration of 100 micromolar, the third three traces had 500 micromolar, the fourth had 1 millimolar, and the fifth had 10 millimolar. The traces are nanoamps vs milliseconds. Ok, so I want to globally fit these 15 traces using a nonlinear custom nonlinear function with lsqcurvefit. Fitting the first three traces was simple since they all had the same concentration. How would I fit all of these traces using my nonlinear function and lsqcurvefit in a loop where the concentration changes? I thought maybe putting all of the xdata (milliseconds) in one matrix, and the ydata (nanoamps) in another matrix and using those as the xdata and ydata that are called into lsqcurvefit, and that worked if the concentration is a fixed number. Now, how would I do this if my matrix was 15 dimensions, and every three columns I needed the nonlinear function to start using a different concentration? I hope this was mostly clear.

Answer by Star Strider
on 11 Apr 2017

Accepted Answer

Mostly, but not entirely.

The lsqcurvefit function is the correct choice.

It would be necessary to know the equations you want to fit, and if the concentration of the unknown substance could be parameterised within them.

How are the data related to the concentrations?

Star Strider
on 11 Apr 2017

I’m not quite certain I understand ‘k1’ and ‘k-2’. I don’t need to know the details, just a bit more about your study. (I assume you know everything except ‘k1’ and ‘k-2’.)

Are they assumed to be constant at the time you’re recording your data, with the drug at an equilibrium concentration? (This is relatively straightforward if I understand your problem correctly.)

Or do they dynamically change during the study as the drug diffuses, and you’re also modeling them as functions of time? (This is much more difficult, and may not be possible to model.)

Is the drug concentration represented anywhere in your model?

Your rather mind-boggling model isn’t the issue. (I’m assuming you’ve coded it and that your objective function works.) I’m curious about what your data represent, and what you’re fitting.

Also, do you have a paired study design, so you have one set of data before the drug is administered to each preparation, and a second set at the equilibrium concentration of the drug?

Kelly McGuire
on 11 Apr 2017

Star Strider
on 11 Apr 2017

I assume the varying concentration of ‘Co’ are accounted for by ‘k1’.

I would define the start time as the time the drug is added to the bath.

It seems that if you have all the other constants (such as ‘Co’, whenever in your experiment you measure it), this is a relatively straightforward two-parameter estimation problem. If so, design your objective function to accept ‘Co’ as an input argument. You may need to use a loop in your objective function to provide the appropriate values of ‘Co’ to fit each column (or row) in your objective function matrix. This is going to be slow, but should be successful. Turn off the sleep option for your computer while you run this.

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.