Array indices must be positive integers or logical values.

syms s;
t=10:0.1:100;
impulse=t==0;
f=32/(s-8);
y=subs(f,s,t);
impulse(y);
plot(y,[impulse]);
xlabel('x');
ylabel('y');
Array indices must be positive integers or logical values.
someone know how is this? i am starting with matlab i dont know why this happening.

4 个评论

syms s
t=10:0.1:100;
impulse=t==0;
f=32/(s-8);
y=subs(f,s,t)
y = 
impulse(y)
Array indices must be positive integers or logical values.

'impulse' appears to be both a function and a variable. If this is unintentional, use 'clear impulse' to remove the variable 'impulse' from the workspace.
What do you expect an index of e.g. 320/21 to return?
%no tengo ni idea, necesito representar grafica la respuesta de estos sistema a la funcion impulso. con %condiciones iniciales nulas
%siendo:
I have no idea, I need to graph the response of these systems to the impulse function. with null initial conditions
being:
f1=32/(s-8)
f2=1280/(s^2 + 16*s + 640);
f3=f=(3456*s+3456)/(s^2+576);
impulse=t==0;
That assigns impulse to be a variable, overriding its existence as a function. Within the rest of the scope, you can no longer call impulse as a function.
You need to define impulse properly. What is impulse?

请先登录,再进行评论。

回答(0 个)

类别

提问:

2022-10-1

评论:

2022-10-2

Community Treasure Hunt

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

Start Hunting!

Translated by