Hi all I'm new to Matlab so some help would be greatly appreciated.
Given the function f(t)=j/2* (exp(-j*2*pi*t)-exp(j*2*pi*t))
I have this code below to plot the function but for some reason I'm getting a straight line. not sure where my error is.
t=-1:0.01:1;
a=1j*0.5;
theta=1j*2*pi*t;
f=a.*(exp(-(theta))-exp(theta));
plot(real(f),imag(f));
axis equal, grid on;

답변 (2개)

KSSV
KSSV 2021년 10월 6일

0 개 추천

You see, your f is not a complex number. As you are plotting it as complex, you are getting a striaght line.
t=-1:0.01:1;
a=1j*0.5;
theta=1j*2*pi*t;
f=a.*(exp(-(theta))-exp(theta));
plot(f);
% axis equal
grid on;
Star Strider
Star Strider 2021년 10월 6일

0 개 추천

The code is correct except for the plot arguments. In the plot, it is necessary to plot the real and imaginary parts aginst ‘t’ instead of each other.
t=-1:0.01:1;
a=1j*0.5;
theta=1j*2*pi*t;
f=a.*(exp(-(theta))-exp(theta));
plot(t,real(f), t,imag(f));
axis equal, grid on
.

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

제품

릴리스

R2021b

질문:

2021년 10월 6일

답변:

2021년 10월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by