Index exceeds the number of array elements
Show older comments
clc
clear
r=0;x=9;
wg=40e6; vo=30e3;voa=0;
for j=1:121
pf(j)=0.4+0.01*(j-1);
if pf<=1
cons(j)=acos(pf(j));
elseif pf>1
cons(j)=-acos(2-pf(j));
end
ia(j)=(wg./(sqrt(3).*vo.*abs(pf(j)))).*(cos(acos(pf(j)))+sin(cons(j)).*i);
eph(j)=(vo./(sqrt(3))).*(cosd(voa)+sind(voa).*i)+ia(j)*(r+i*x);
E(j)=sqrt(3).*abs(eph(j));
Ifex(j)=abs(E(j))./3464.1;
iax(j)=abs(ia(j));
end
plot(Ifex,iax)
grid
xlabel('Field current (A)')
ylabel('Armature current (A)')
title('V curve of synch. generator')
if i juse else only in the if statement, the code will run but the plot will be incomplete, and if i put elseif pf>1, I get an error
1 Comment
Osama Aliwat
on 7 Dec 2021
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing 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!