x=[0:.01:10];
y=(x.^2).*(exp(-x));
plot(x,y), grid
y1=max(y);
xlabel(\'TIME\');
ylabel(\'CONCENTRATION IN BLOOD\');
title(\'CONCENTRATIN OF SUSTANCE IN BLOOD vs TI
In addition to the solutions already posted, I am adding other ways to solve the problem:
f = @(x) (x.^2).*(exp(-x)); %# function handle
y0 = 0.3;
format long
%# find root of function near s0
x1 = fzero(@(x)f(x)-y0, 1) %# find solution near x=1
x2 = fzero(@(x)f(x)-y0, 3) %# find solution near x=3
%# find minimum of function in range [s1,s2]
x1 = fminbnd(@(x)abs(f(x)-y0), 0, 2) %# find solution in the range x∈[0,2]
x2 = fminbnd(@(x)abs(f(x)-y0), 2, 4) %# find solution in the range x∈[2,4]