how to draw a line bewteen two points using the exponential distribution?
6 views (last 30 days)
I have this figure
and I want to draw a line between the head of first bar (at x=-25) and the end of the red curve(at x=0) like this:
I try to draw the line using the exponential distribution
mu=expfit(EEPY); % n estimate parameters maximum likelihood exponential
xgride = linspace(-25,0,100);
and I try another way to draw the line
plot(xvaluese,yvaluese,'g--') % this plot a straight line
but I got nothing...
how I could match the two points
Kelly Kearney on 10 Nov 2015
expdf fits a pdf to a distribution of points... it doesn't define the pdf at given x-coordinates. So in your code, you're fitting an exponential distribution to uniform data (the x-coordinates), which is of course not what you want.
If you just want a curve following the approximate shape of a negative exponential, then I recommend defining the curve explicitly, rather than messing with fitting:
x1 = -25; % Coordinates of first bar
y1 = 0.015;
x2 = 0; % Coordinates of red line start
y2 = 0.0025;
dy = y1 - y2;
dx = x2 - x1;
k = 1;
f = @(x) dy.*exp(-k*(x + dx)) + y2;
x = linspace(x1, x2, 50);
y = f(x);
You can adjust the k parameter to get a steeper or shallower drop-off in the curve.