Undefined function 'x' for input arguments of type 'double'. Why does this flag that particular line and nowhere else? Is there a was to fix it?

1 visualización (últimos 30 días)
%% Problem 3 Bungie Jump
mp=50;
k=10;
L=5;
g=9.81;
t0=0;
tf=45;
dt=0.02;
tspan=[t0:dt:tf];
% initial conditions
x0=2;
y0=0;
xdot0=0;
ydot0=0;
IC=[x0 xdot0 y0 ydot0];
[t,z]=ode45(@bungie_ode,tspan,IC,[],mp,k,L,g);
y=z(:,1);
y=z(:,3);
%figure
for i=L:length(t)
px=[0 x(i)];% Undefined function 'x' for input arguments of type 'double'. Error in ProgramName (line 81)px=[0 x(i)];
py=[0 y(i)];
qx=[10 x(i)];
qy=[0 y(i)];
plot
end

Respuestas (1)

Walter Roberson
Walter Roberson el 28 de Feb. de 2021
y=z(:,1);
y=z(:,3);
should be
x=z(:,1);
y=z(:,3);

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by