How can I write this exponential function in matlab

답변 (2개)

Ameer Hamza
Ameer Hamza 2020년 6월 27일
편집: Ameer Hamza 2020년 6월 27일
One way to write this is to create an anonymous function
f = @(t) 0.2*exp(-1i*(8*pi*t-pi/2))+0.585*exp(-1i*(7*pi*t-deg2rad(78.69)));
and then run it like this
>> f(0)
ans =
0.1147 + 0.7736i
>> f(1)
ans =
-0.1147 - 0.3736i
>> f(2)
ans =
0.1147 + 0.7736i
>> f(pi)
ans =
0.0177 + 0.3937i
Alternatively, create a function file named myFun.m (or whatever you want. The name of file and function must be same) and define a function like this
function y = myFun(t)
y = 0.2*exp(-1i*(8*pi*t-pi/2))+0.585*exp(-1i*(7*pi*t-deg2rad(78.69)));
end
and then you can call it like this myFun(0), myFun(pi), etc.
Hamed
Hamed 2024년 2월 3일

0 개 추천

how i "exp(u(1))" and (u(1^3)) function setting! thanks

댓글 수: 1

u(1^3) does not make any sense?
exp(u(1))
exp(u(1)^3)
exp(u(1))^3

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

질문:

2020년 6월 27일

댓글:

2024년 2월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by