How to plot complex signal

조회 수: 90 (최근 30일)
Tiam Huat Goh
Tiam Huat Goh 2014년 10월 25일
댓글: Image Analyst 2023년 2월 28일
I'm very new to MatLab, how do i write a program in MatLab to plot : x(t) = cos (t) + j sin (t)
I was told it should be a circle but I'm seeing sinusoidal signal....
Thks in advance.
Mac. Goh

채택된 답변

Image Analyst
Image Analyst 2014년 10월 25일
Try this
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
t = linspace(0, 2*pi, 90);
j = sqrt(-1);
complexSignal = cos(t) + j*sin (t)
% Get the real component and plot it on the x axis
x = real(complexSignal);
y = imag(complexSignal);
plot(x, y, 'bo-', 'LineWidth', 2);
grid on;
title('Plot of cos(t) + j*sin (t)', 'Fontsize', fontSize);
xlabel('Real Component', 'Fontsize', fontSize);
ylabel('Imaginary Component', 'Fontsize', fontSize);
axis square;
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);

추가 답변 (2개)

Star Strider
Star Strider 2014년 10월 25일
편집: Star Strider 2014년 10월 25일
You have to plot the real parts and imaginary parts:
t = linspace(0,2*pi);
x = @(t) cos (t) + j*sin (t);
figure(1)
plot(real(x(t)), imag(x(t)))
grid
axis equal
xlabel('Re\{x\}')
ylabel('Im\{x\}')

Onimisi
Onimisi 2023년 2월 28일
V=240 % Voltgae across both loads
V = 240
SL1r=120000 % Real Power consumed by load 1
SL1r = 120000
STr=400000 % Total real power consumed
STr = 400000
pf1=0.8 % Power Factor of both Loads
pf1 = 0.8000
pf2= 0.96 % Power of only load 1 leading
pf2 = 0.9600
theta1=acosd(pf1)
theta1 = 36.8699
theta2=acosd(pf2)
theta2 = 16.2602
b=theta1
b = 36.8699
c=theta2
c = 16.2602
j=sqrt(-1)
j = 0.0000 + 1.0000i
complexST=(cosd(b))+(j*sind(b))
complexST = 0.8000 + 0.6000i
complexSL=(cosd(c))+(j*sind(-c))
complexSL = 0.9600 - 0.2800i
ST=(STr/pf1)*complexST
ST = 4.0000e+05 + 3.0000e+05i
SL1=(SL1r/pf2)*complexSL
SL1 = 1.2000e+05 - 3.5000e+04i
SL2=ST-SL1
SL2 = 2.8000e+05 + 3.3500e+05i
  댓글 수: 1
Image Analyst
Image Analyst 2023년 2월 28일
@Onimisi I think you meant to post this as your own question since your post does not seem to be an Answer to @Tiam Huat Goh's 8 year old question.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by