0

I am trying to fit some data to an asymmetric double sigmoidal (ADS) function in Matlab. I got the function from a paper on deconvolution of kinetic data and I wanted to try it out myself for future use (In case you are interested: https://link.springer.com/article/10.1007%2Fs10973-012-2500-6).

I am using a nonlinear fit:

modelfun = 'y ~ (b1/(1+exp(-(x-b2+(b3/2))/b4)))*(1-(1+exp((x-b2+(b3/2))/b5))^(-1))'

beta0 = [0.1 -14 55 1 -7]

mdlS = fitnlm(tempS, signalS, modelfun, beta0)

I get this as the first error, among others:

Error using classreg.regr.NonLinearFormula/parseStr (line 315)

Unable to understand the formula character vector 'y~(b1/(1+exp(-(x-b2+(b3/2))/b4)))*(1-(1+exp((x-b2+(b3/2))/b5))^(-1))'.

It says that access to the method is protected and I have checked many times if whether I typed-in the right function.

Am I missing something? Or is fitnlm just inappropriate for this function?

Thank you in advance.

Community
  • 1
  • 1
Tarkus
  • 21
  • 2
  • I have always used '~' to define my functions and it has always worked. In the documentation for nonlinear regression it says that you can define functions that way and it has always worked for me for many other functions. Why should it be different for this one? Example: If I use >modelfun = 'y ~ b1+(b2/(1+exp((x-b3)*b4)))' The script works. – Tarkus Jun 23 '17 at 11:01
  • uh, sorry then, nevermind – Leander Moesinger Jun 23 '17 at 11:06
  • try the anonymous function, that should also work and it is a nicer way of doing things anyways, compared to writing a string.. – Vahe Tshitoyan Jun 23 '17 at 11:07
  • for example `modelfun = @(b,x) (b(1)./(1+exp(-(x-b(2)+(b(3)/2))/b(4)))).*(1-(1+exp((x-b(2)+(b(3)/2))/b(5))).^(-1)); ` – Vahe Tshitoyan Jun 23 '17 at 11:09
  • Thanks I will try it with the anonymous funtion – Tarkus Jun 23 '17 at 12:24

0 Answers0