How to implement Complex Exponential Function Using Matlab ?

29 views (last 30 days)
Please
How can I implement the Complex Exponential Function mentioned in this equation:
X(N) =exp^(j*w1*N) + exp^(j*w2*N)
Suppose:
F =40KHZ
N=Range 1 to 20
w1: is the first angular frequency
w1=2*pi*F
w2: is the second angular frequency
w2=2*pi*F
Finally,
display the values are saved in X(N) in command window.
We apply fast fourier transform (FFT) on X(N) Then we plot the result.

Accepted Answer

Star Strider
Star Strider on 3 Nov 2023
I am not certain what you are doing or what ‘w1’ and ‘w2’ are, so using my best guess —
format longE
F = 40E+3;
N = (0:20).';
omega1 = 2*pi*F; % Guessing: 'W1'
omega2 = 4*pi*F; % Guessing: 'w2'
X = exp(1j*omega1*N) + exp(1j*omega2*N)
X =
2.000000000000000e+00 + 0.000000000000000e+00i 2.000000000000000e+00 - 1.165637649496438e-11i 2.000000000000000e+00 - 2.331275298992875e-11i 2.000000000000000e+00 - 3.496912948489312e-11i 2.000000000000000e+00 - 4.662550597985751e-11i 2.000000000000000e+00 + 2.909640830059826e-10i 2.000000000000000e+00 - 6.993825896978625e-11i 2.000000000000000e+00 - 4.308406009455551e-10i 2.000000000000000e+00 - 9.325101195971502e-11i 2.000000000000000e+00 + 2.443385770261251e-10i 2.000000000000000e+00 + 5.819281660119652e-10i 2.000000000000000e+00 - 4.774661069254125e-10i 2.000000000000000e+00 - 1.398765179395725e-10i 2.000000000000000e+00 + 1.977130710462676e-10i 2.000000000000000e+00 - 8.616812018911102e-10i 2.000000000000000e+00 - 5.240916129052701e-10i 2.000000000000000e+00 - 1.865020239194300e-10i 2.000000000000000e+00 - 1.245896296856808e-09i 2.000000000000000e+00 + 4.886771540522501e-10i 2.000000000000000e+00 - 5.707171188851276e-10i 2.000000000000000e+00 + 1.163856332023930e-09i
.
  13 Comments
Muhammad Salem
Muhammad Salem on 4 Nov 2023
I am really sorry
The question has been updated. Perhaps the question contains some errors or may not be clear.
Please give me the answer again
Star Strider
Star Strider on 4 Nov 2023
That simply requires minor tweaks to the existing code.
See the documentation on the fft function to perform the Fourier transform. There are abundant examples throughout Answers. (I wrote many of them.)
That result may not be very exciting to view, since ‘X’ is created by returning integer multiples of .

Sign in to comment.

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!