exm05111_1.m

来自「这是本人收集的一些程序源代码」· M 代码 · 共 17 行

M
17
字号
%exm05111_1.m
t=linspace(0,5,100);y=1-cos(3*t).*exp(-t);
shg
plot(t,y,'b');grid;hold on,plot(t,0.95*ones(size(t)),'r');hold off  
t_ginput=ginput(1)  
%
it=min(find(y>0.95));
T=(it-3):(it+3);														%	<2>
t_nearst=interp1(y(T),t(T),0.95,'nearst');						%	<3>
t_linear=interp1(y(T),t(T),0.95);									%	<4>
t_cubic=interp1(y(T),t(T),0.95,'cubic');							%	<5>
t_spline=interp1(y(T),t(T),0.95,'spline');						%	<6>
disp(['  t_nearst  t_linear   t_cubic   t_spline'])
disp([t_nearst  t_linear   t_cubic   t_spline])  
%
t_zero=fzero('1-cos(3*x).*exp(-x)-0.95',0.5)  

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?