Plot a graphic with a complex function and 2 variables
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello guys! I'm new in matlab and need some help. I want to make two graphics of these equations below , to see how P and Q behave when teta varies between -180 to 180 degrees.
P = ((Vs * Vr) / Z) * sin (theta);
Q = (((Vs * Vr) / Z) * (1-(cos (theta)));
Where
Vs = Vrln+(Ir*cos(thetar)+ j (Ir*sin(thetar)))*Z
Vr = Vsln-(Is*cos(thetas)+ j (Is*sin(thetas)))
theta = thetas - thetar
The values of Vsln, Vrln and Z are complex numbers with imag and real parts. I know is needed a loop for the teta var, but how i do that, and plot the graphics?
clc
clear
% Cálculo das Variáveis y e z
prompt = 'Digite o Comprimento da linha em km: ';
l = input(prompt);
prompt = 'Digite o Valor de Z em ohms: ';
za = input(prompt);
prompt = 'Digite o Valor de X em ohms: ';
xa = input(prompt);
z = complex(za,xa);
prompt = 'Digite o Valor de C: ';
C = input(prompt);
j1 = 2*pi*60*C;
y = complex(0, j1);
%Cálculo para comprimento total da linha
Z = z*l;
disp('O valor de Z será:')
disp(Z);
Y = y*l;
disp('O valor de Y será:')
disp(Y);
%Cálculos LT Curta
prompt = 'Digite a Tensão de funcionamento da linha em kV: ';
Vs = input(prompt);
prompt = 'Digite a Tensão no receptor em kV: ';
Vr = input(prompt);
Vrln = (Vs/(sqrt(3)));
disp('O valor de Vr(l-n) será');
disp(Vrln);
Vsln = (Vr/(sqrt(3)));
disp('O valor de Vs(l-n) será');
disp(Vsln);
Is = (Vs-Vr)/Z;
disp('O valor de Is será');
disp(Vrln);
%Loop potência variando o ângulo no receptor
syms ang
P=((Vsln*Vrln)/Z)*sin(ang);
댓글 수: 0
채택된 답변
KSSV
2017년 4월 4일
Note that you need not to use a loop for that calculation. Check the below pseudo code. I have taken the required variables as random, you can replace them with yours.
N = 100 ;
theta = linspace(-180,180,N)*pi/180 ; % ang;le in raidans
Vs = rand ; % a random value
Vr = rand ; % a random value
Z = rand ; % a random value
P = ((Vs * Vr) / Z) * sin (theta);
Q = (((Vs * Vr) / Z) * (1-(cos (theta))));
plot(theta,P)
hold on
plot(theta,Q)
legend('P', 'Q');
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Preprocessing Data에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!