How to evaluate a curve at infinite points inside it's upper and lower bounds.
    3 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Patrick Lokken
 il 4 Feb 2020
  
    
    
    
    
    Commentato: John D'Errico
      
      
 il 7 Feb 2020
            Please see attached dataset and image. I want to be able to evaulate infinite points along the interpolated curve that these points create. Is there a way to do this? I've tried using the cftool, but haven't come up with anything useful. It does not fit an exponential or gaussian curve well enough for what I need. I'm probably missing something very basic. Thank you for taking a look!!!

2 Commenti
  John D'Errico
      
      
 il 4 Feb 2020
				You want to evaluate the curve at infinitely many points? Do you have a long time to wait? Infinity is a long way away, even if your computer is fast.
Your curves do not appear to fit well down in the lower tail, but that is reasonable, given that you are plotting it on a LOG scale. When data falls over multiple orders of magnitude, it is common to expect an unweighted standard fit to fit poorly at one end.
Perhaps, by the phrase "infinite points" you are hoping to find a good prediction for an asymptote?
What does "infinite points" mean to you? Please explain more clearly.
  Walter Roberson
      
      
 il 4 Feb 2020
				
      Modificato: Walter Roberson
      
      
 il 4 Feb 2020
  
			fit() creates a fit object that you can use like a function to call on a value to predict the output there, so
fitobj = fit(....);
fitobj(inf)
In some cases you might have to extract the formula and substitute in symbolic variables for the parameters, and then use symbolic limit() at infinity
Risposta accettata
  Patrick Lokken
 il 7 Feb 2020
        3 Commenti
  John D'Errico
      
      
 il 7 Feb 2020
				The problem is, if you tell people that interp1 can solve this, then you will lead them to the wrong solution much of the time. Accepting your own answer here implies it is the right solution. And we have not even agreed on that as correct. You CAN use interp1 to interpolate a curve like that, as long as you do not wish to do any smoothing, AND as long as you use either the linear option or the pchip option to interp1, it will work acceptably. However, even attempting to extrapolate a pchip interpolant can be a risky idea, and you talk about that too. Extrapolating splines (which includes pchip in this respect) is rarely safe, unless you have constructed the spline in an intelligent way, and you know how to extrapolate them safely.
Novice users will then try to use a spline to interpolate (because they want a nice smooth result), and then their next ansguished question will be essentially "Why does interp1 do insane things?"
So by accepting your own answer without actually understanding the implications thereof, without really understanding what you are doing, you create misinformation, and you WILL lead at least some people into the wrong conclusions, because they believe you.
I'm, sorry, but it is possible that you are trying to squash a bug with a screwdriver. Yes, interp1 CAN work, as long as you know how to use it properly.
Più risposte (1)
  John D'Errico
      
      
 il 4 Feb 2020
        
      Modificato: John D'Errico
      
      
 il 4 Feb 2020
  
      If I plot your data, it it far too highly nonlinear to use any sort of a fit to the data directly. But plotted on log-log axes, we see:
loglog(x,y,'.')

The solution is to log your data, then model that. rather than bother to find a model that seems reasonable for this, I'll just use my SLM toolbox.
slm = slmengine(log(x),log(y),'knots',10,'decreasing','on','rightslope',0,'plot','on')

Can you predict a value at any point for , in the domain of your data? Of course. For example, at x=1000...
xhat = 1000;
yhat = exp(slmeval(log(xhat),slm))
yhat =
    0.0625068383912338
The asymptote at the right end is 
exp(slmeval(log(max(x)),slm))
ans =
    0.0158793038009348
Works fine. Find SLM on the File Exchange.
0 Commenti
Vedere anche
Categorie
				Scopri di più su Get Started with Curve Fitting Toolbox in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


