# How to plot magnitude and phase of a Fourier Transform

29 visualizaciones (últimos 30 días)
Anthony Koning el 13 de Feb. de 2022
Respondida: Star Strider el 13 de Feb. de 2022
Hello, I am currently trying to plot the magnitude and phase of a Fourier transform of 1/(0.6+iw) where i is the imaginary number and w is a phase ranging from -4 to 4. My code is currently
w = [-4:0.1:4]
X(w)=1./(0.6+(i.*w))
figure, plot(w, abs(X)), title('Amplitude plot')
figure, plot(w, angle(X)), title('Phase plot')
plot X(w)
but I keep getting an error message of "Array indices must be positive integers or logical values.". Could someone explain this error to me, and if this is the correct code to use for this type of problem? Thanks.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Star Strider el 13 de Feb. de 2022
Convert ‘X’ into an anonymous function, the evaluate it in the plot calls —
w = [-4:0.1:4];
X = @(w) 1./(0.6+(1i.*w));
figure, plot(w, abs(X(w))), title('Amplitude plot')
figure, plot(w, angle(X(w))), title('Phase plot')
See the documentation on Anonymous Functions for details.
.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Categorías

Más información sobre Axes Appearance en Help Center y File Exchange.

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by