Plot a graphic with a complex function and 2 variables
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
KSSV
le 4 Avr 2017
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');
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Function Creation dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!