ERROR: array indices must be positive integers or logical values

The program does not graph the temr function, only recognize tem function and always shows the same error in temr line(Array indices must be positive integers or logical values)
U=220;f=50;p=3;R1=4;R2=4;X1=6;X2=6;m=3;
n1=60*f/p;
s=0.001:0.001:1;
n=(1-s)*n1;
R2r=R2+46;
Tem=@(s)((m*p*U^2*R2./s)./(2*pi*f*((R1+R2./s).^2+(X1+X2)^2)));
Temr=@(s,R2r)((m*p*U^2*R2r./s)./(2*pi*f((R1+R2r./s).^2+(X1+X2)^2)));
plot(Tem(s),n,'r');
xlabel('Tem/n*m');
ylabel('n/r/min');
hold on;
plot(Temr(s,R2r),n,'b');
legend('After Regulation','Before Regulation');

More Answers (0)

Categories

Find more on Vehicle Dynamics Blockset 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!