Setting a variable's value as a known constant in a custom equation to be fit to data

11 views (last 30 days)
Hi! I'm trying to fit a set of custom data over and over again following a certain procedure to a custom model. The problem is as follows. In each iteration of this process, I calculate a custom parameter called Kprime. Then, I want to fit the data to the custom model 'exp( (1 + Kprime)*b*x)' where Kprime is a constant in the fit model but a variable in the system. Unfortunately, whenever I run this script, MATLAB keeps thinking Kprime is a constant to be found just like b and asks for two startpoints, upperbounds, lowerbounds, etc. How can I let MATLAB know that Kprime is not a constant to be found but a rather a known constant whose value needs to be looked up from the variable Kprime's current value in the system? Thanks in advance!

Answers (1)

Maria-Daphne Mangriotis
Maria-Daphne Mangriotis on 31 Mar 2021
Edited: Maria-Daphne Mangriotis on 31 Mar 2021
Hi there! This is an old post, but I am answering in case others have the same question. I managed to solve this, by using
options = fitoptions(ft)
and setting the options.Upper and options.Lower equal to the constant I wanted for a specific parameter. It seems to work!

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!