Repeating a function for different values that involves imaginary numbers.

I am working on getting the output for a function that includes the calculations of imaginary numbers. It works when I have
f=[1000:1000000]
w=2*pi*f
X=0.2/j*w,
However, when I takes Y=1/X, the calculation failsa and I get no output. Sorry if the question is too shallow as I just learning this tool recently.

 Respuesta aceptada

5 comentarios

Voss
Voss el 24 de Feb. de 2024
Editada: Voss el 24 de Feb. de 2024
Also, you probably mean
X = 0.2./(j*w)
That is, the w should be in the denominator with the j.
Also, for clarity use 1j instead of j.
X = 0.2./(1j*w)
Yes, I mean X = 0.2./(j*w). I wonder what is the difference between 1j and j in term of clarification?
"what is the difference between 1j and j"
No difference, unless you have a variable j already defined, in which case j is that j.
1j is always the imaginary unit, which is why it's more clear.
Thank you for the clarification. I now see the importance of clarity in using Matlab.
Voss
Voss el 24 de Feb. de 2024
Editada: Voss el 24 de Feb. de 2024
You're welcome. Any other questions, let me know. Thanks!

Iniciar sesión para comentar.

Más respuestas (1)

Torsten
Torsten el 24 de Feb. de 2024
Movida: Torsten el 24 de Feb. de 2024
X is a vector, not a scalar.
The elementwise division of 1 by a vector has to be coded as
1./X
instead of
1/X

Categorías

Etiquetas

Preguntada:

Gee
el 24 de Feb. de 2024

Editada:

el 24 de Feb. de 2024

Community Treasure Hunt

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

Start Hunting!

Translated by