how to write code that performs the function

and how Evaluate the function at input values of x & n determined by the user, then keep the real part of the complex result at A and the imaginary part at B.

7 件のコメント

KSSV
KSSV 2022 年 5 月 30 日
What have you tried?
abod farawi
abod farawi 2022 年 5 月 30 日
I am learning new and do not understand it well
Torsten
Torsten 2022 年 5 月 30 日
編集済み: Torsten 2022 年 5 月 30 日
f = @(x,n) x.^(1i.^(n-1)+2./n) - 1i*abs(5*cos(exp(1i.*sqrt(n).*x)))
real(f(4,3))
imag(f(4,3))
Walter Roberson
Walter Roberson 2022 年 5 月 30 日
Note: syms requires the Symbolic Toolbox be installed and licensed.
Hiro Yoshino
Hiro Yoshino 2022 年 5 月 30 日
if you run it with Symbolic Math Toolbox, it goes as follows:
syms x n i
f = x^(i^(n-1)+2/n) - abs(5*cos(exp(1i*sqrt(n)*x)))
f = 
Walter Roberson
Walter Roberson 2022 年 5 月 31 日
I think i = sqrt(-1) there, and also a trailing i got missed
syms x n
f = x^(i^(n-1)+2/n) - abs(5*cos(exp(1i*sqrt(n)*x)))*i
Torsten
Torsten 2022 年 5 月 31 日
Since you don't seem to have a licence for the symbolic toolbox, I showed you a way how to circumvent symbolic computations.
And since you don't want to "solve" or "dsolve" anything, I also don't see the necessity to go the symbolic way.

サインインしてコメントする。

回答 (0 件)

タグ

質問済み:

2022 年 5 月 30 日

コメント済み:

2022 年 5 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by