Why does it give me a problem stating that, Index must not exceed 1?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
the cyclist
2021-11-24
编辑:the cyclist
2021-11-24
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
2021-11-24
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!