フィルターのクリア

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

18 ビュー (過去 30 日間)
Sergey Dukman
Sergey Dukman 2015 年 9 月 9 日
コメント済み: Steven Lord 2015 年 9 月 9 日
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 Center および File ExchangeOptimization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by