How to find X value given Y value and show it
3 views (last 30 days)
Show older comments
I am trying to find a value in a plot that is generated using the following matlab function. I've tried using this z=find(y==0.0625); but it doesn´t seem to be working.
function con = funcCon (cMax)
% Time when the max concentration happens.
B = 3;
% mg to administer.
A = (cMax / B) * exp(1);
% Time.
t = [1:50];
y(1,1) = 0;
for i = 2:50
con = A*t(1,i)*exp(-t(1,i)/B);
y(1,i) = con;
end
plot(t,y)
end
0 Comments
Answers (1)
Image Analyst
on 30 Jan 2021
See the FAQ:
Try this
[yMax, indexOfMax] = max(y)
tMax = t(indexOfMax)
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!