Why does it give me a problem stating that, Index must not exceed 1?
1 view (last 30 days)
Show older comments
ADRIAN JAVIER AREITIO TRILLO
on 24 Nov 2021
Commented: ADRIAN JAVIER AREITIO TRILLO
on 25 Nov 2021
for k=1,1:120
del_ZS1=(del_VS1)./(del_IS1)
del_ZR1=(del_VR1)./(del_IR1)
end
figure(5);
% SIDE S - trajectory of incremental positive-sequence impedance with
% marking the starting/ending point. For all of the cases. all simulation
% cases
plot(real(del_ZS1),imag(del_ZS1))
hold on
grid on
plot(real(del_ZS1(1)),imag(del_ZS1(1)),'xr')
hold on
plot(real(del_ZS1(60)),imag(del_ZS1(60)),'kr')
hold on
title('side S - Trajectory of incremental positive-sequence impedance')
legend('del_ZS1','start','end')
xlabel('Real');
ylabel('Imaginary');
3 Comments
Answers (2)
the cyclist
on 24 Nov 2021
Edited: the cyclist
on 24 Nov 2021
When you define del_ZS1 in the initial for loop, it is not a vector. It is a single, scalar value.
When you try to do
del_ZS1(60)
you try to access the 60th element, but there is only one element.
Perhaps you intended something more like
for k=1,1:120 % <---- Maybe this was supposed to be just k=1:120 ???
del_ZS1(k)=(del_VS1)./(del_IS1)
del_ZR1(K)=(del_VR1)./(del_IR1)
end
?
Jan
on 24 Nov 2021
I guess, that the error occurs here:
plot(real(del_ZS1(60)),imag(del_ZS1(60)),'kr')
The message means, that del_ZS1 is a scalar and does not have 60 elements. Use the debugger to check this:
dbstop if error
Type this in the command window and run the code again. Then Matlab stops at the error and you can check the dimensions of the variable in the command window or workspace browser.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!