How to define the value of "t" from function f(t)

18 次查看(过去 30 天)
Hello,
I have a function
f(t)=exp(-0.01*t.^2).*cos(2.*t)
where 't' is a function handle (f=@t)
I need to define 't' when f(t)=0.4.
How do I do this?
Sergey

采纳的回答

Walter Roberson
Walter Roberson 2015-9-9
It sounds to me like you might be attempting to solve exp(-0.01*t.^2).*cos(2.*t) to find the t where the expression becomes 0.4 . If so then there are an infinite number of solutions. You can find one of them by using
syms f(t)
f(t) = exp(-0.01*t.^2).*cos(2.*t);
vpasolve(f(t)=0.4)
  2 个评论
Sergey Dukman
Sergey Dukman 2015-9-9
Hello, Yes, you are right. I need to find t when f(t)=0.4. Thank you for help!
Sergey
Steven Lord
Steven Lord 2015-9-9
Or if you don't have Symbolic Math Toolbox, you could use FZERO from MATLAB. Rewrite your expression so it's in the form g(t) = 0:
f = @(t) exp(-0.01*t.^2).*cos(2.*t);
g = @(t) f(t)-0.4; % Transforming f(t) = 0.4 -> f(t)-0.4 = 0
Then call FZERO to find a zero of g(t). Change the initial guess to locate additional zeros.
fzero(g, 0)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Optimization 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by