How to plot complex signal
99 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Tiam Huat Goh
il 25 Ott 2014
Commentato: Image Analyst
il 28 Feb 2023
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
0 Commenti
Risposta accettata
Image Analyst
il 25 Ott 2014
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]);
0 Commenti
Più risposte (2)
Star Strider
il 25 Ott 2014
Modificato: Star Strider
il 25 Ott 2014
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\}')
0 Commenti
Onimisi
il 28 Feb 2023
V=240 % Voltgae across both loads
SL1r=120000 % Real Power consumed by load 1
STr=400000 % Total real power consumed
pf1=0.8 % Power Factor of both Loads
pf2= 0.96 % Power of only load 1 leading
theta1=acosd(pf1)
theta2=acosd(pf2)
b=theta1
c=theta2
j=sqrt(-1)
complexST=(cosd(b))+(j*sind(b))
complexSL=(cosd(c))+(j*sind(-c))
ST=(STr/pf1)*complexST
SL1=(SL1r/pf2)*complexSL
SL2=ST-SL1
1 Commento
Image Analyst
il 28 Feb 2023
@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:
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!