matlab, how do i write a statement that will give me time on xaxis from y=0.3

前端 未结 5 1270
情书的邮戳
情书的邮戳 2020-12-11 22:34
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         


        
5条回答
  •  我在风中等你
    2020-12-11 22:44

    An easier way to find the index (and therefore x-value) is:

    [minDiff, index] = min(abs(y-0.3))
    
    minDiff =
    
      3.9435e-004
    
    
    index =
    
        84
    
     x(index)
    
    ans =
    
        0.8300
    

提交回复
热议问题