Plot complex signal with imaginary and complex

조회 수: 45 (최근 30일)
nirwana
nirwana 2023년 3월 23일
편집: Star Strider 2023년 3월 23일
Hi....i would like to plot imaginary and real number of my signal. The expected output as shown below, but i don'e know which plot in matlab that i have to use. Please help me

채택된 답변

Star Strider
Star Strider 2023년 3월 23일
편집: Star Strider 2023년 3월 23일
This is relatively straightforward —
Fs = 1000;
Tlen = 10;
t = linspace(0, Tlen*Fs, Tlen*Fs+1)/Fs;
s = exp(1j*t*2*pi);
Res = real(s);
Ims = imag(s);
figure
plot3(t, Res, Ims, '-k', 'DisplayName','Complex Signal')
hold on
plot3(t, Res, zeros(size(Res))-1, 'DisplayName','Re')
plot3(t, zeros(size(Ims))+1, Ims, 'DisplayName','Im')
hold off
axis('equal')
legend('Location','best')
grid on
xlabel('Time','Rotation',30)
ylabel('Real', 'Rotation',-33)
zlabel('Imaginary')
Tweak it to get the results you want.
.

추가 답변 (2개)

Antoni Garcia-Herreros
Antoni Garcia-Herreros 2023년 3월 23일
Hello Nirwana,
You can take a look at this thread
You could try something like this
plot3(x,y,z)
hold on
plot3(x, 2*ones(size(y)), z, 'LineWidth', 2); % project in x-z axis at y=1
plot3(x, y, -2*ones(size(x)), 'LineWidth', 2); % project in y-z axis at z=-2

John D'Errico
John D'Errico 2023년 3월 23일
n = 2000;
t = linspace(0,500,n);
Signal = cos(t/10) + i*sin(t/10); % a simple signal, as a function of time.
plot3(t,real(Signal),imag(Signal),'r-')
hold on
plot3(t,repmat(1.5,1,n),imag(Signal),'b-')
plot3(t,real(Signal),repmat(-1.5,1,n),'c-')
ylim([-1.5 1.5])
zlim([-1.5 1.5])
xlabel 'Time'
ylabel 'Real part'
zlabel 'Imaginary part'

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by