Getting x value for a given y value from a fitted model

4 vues (au cours des 30 derniers jours)
Jakub Bialek
Jakub Bialek le 17 Juil 2013
Hi,
I have my code:
curve = @(a, b, c, d, e, x) a./(b+exp(-c*(x-d)))+e;
lower_bound = [-Inf -Inf -Inf 0, 0];
upper_bound = [Inf Inf Inf max(x), max(y)];
starting_param = [max(y) 1 1 x(round(length(x)/2)), min(y)];
sigm=fit(x, y, curve, 'StartPoint', starting_param, 'Lower', lower_bound, 'Upper', upper_bound) ;
I'm getting my fit result in the sigm which is cfit type.
My question is: how to obtain x value from a given y value out of sigm? If I write ans=sigm(0.5) I'm getting y value for a x=0.5 What I want is to get x value for y=0.5. How to code it?
thanks for help!
  1 commentaire
Daniel Pereira
Daniel Pereira le 17 Juil 2013
Why not fitting x=g(y) instead of y=f(x)?

Connectez-vous pour commenter.

Réponse acceptée

dpb
dpb le 17 Juil 2013
A) Evaluate the function over a range of x and then use interp1 to interpolate over the response to find a given x that gives a desired value.
B) Use fsolve() Recast the function to form f(x)-y = 0 where y is your target value.

Plus de réponses (0)

Catégories

En savoir plus sur Multicore Processor Targets dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by