필터 지우기
필터 지우기

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 CenterFile Exchange에서 Optimization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by