Unrecognized function or variable 'P_v'. Solutions please!!!

%Datos base
clear all;
close all;
f1=50;
T1=1/f1;
td=0;%tiempo muerto
Modulation=0;%SPWM=0 CB-SPWM=1
control=0;%control =0: n y N aislados; control =1: n y N conectados
%%%%%%%%%%%%%%%%%%%%%%%
mf=21;%Para ver el efecto de los tiempos muertos poner un mf elevado (101) por ejemplo
ma=0.5;%Indice modulación en amplitud
Ts=1/(f1*mf);
Tsample=Ts/200;%para el step máximo de simulación
Vector_pico= (301:321:5);
for i=1:length(Vector_pico)
Vpico=Vector_pico(i);
sim('Actividad_6');
P_vec(i)= P(end);
Q_vec(i)= Q(end);
end
%Representación
figure(1)
plot(Vector_pico, P_vec);
tittle('Variacion de Potencia activa con diferente desfase');
xlabel ('Potencia activa');
ylabel ('desfase');
figure(1)
plot(Vector_pico, Q_vec);
tittle('Variacion de Potencia reactiva con diferente desfase');
xlabel ('Potencia activa');
ylabel ('desfase');
-----------------------------------------------------------------------------------------------------
THIS IS THE ERROR!!!
Unrecognized function or variable 'P_vec'.
Error in actividad6 (line 31)
plot(Vector_pico, P_vec);

Answers (1)

Vector_pico= (301:321:5);
That is a vector that starts at 301, and has an increment of +321, and has an upper bound of 5 . Because the upper bound is less than the lower bound and the increment is positive, the vector is empty.
Vector_pico= (301:5:321);
would be a vector that started at 301, had an increment of 5, and an upper bound of 321. It would have the values [301, 306, 311, 316, 321]

Categories

Find more on Signal Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!