MDColD
MDColD

Reputation: 3

How can I find a max value of a selected region in a fit?

I am trying to find a max value of a curve fitted plot for a certain region in this plot. I have a 4th order fit, and when i use max(x), the ans for this is an extrapolated value, while I am actually looking fot the max value of the 'bump' in my data. So question, how do I select the max for only a certain region in the data while using a cfit? Or how do I exclude a part of the fit?

LF = pol4Fit(L,F);
Coefs= coeffvalues(LF); 

This code does only give the optimum (the max value) of the real points:

L_opt = feval(LF,L);
[F_opt,Num_Length]= max (L_opt);
Opt_Length= L(Num_Length); 

So now I was trying something like: y=max(LF(F)), but this is not specific to select a region.

Upvotes: 0

Views: 86

Answers (1)

Mehrdad Zandigohar
Mehrdad Zandigohar

Reputation: 251

Try to only evaluate the region you are interested in. For instance, let's say the specific region is a vector named S. You can simply rewrite your code like below:

L_opt = feval(LF,S);

Use the specific domain region S instead of the whole domain L and it only evaluates the region you are concerned with. Then using max function should work properly for you.

Upvotes: 3

Related Questions