How can I define successive vectors by matlab?

1 visualización (últimos 30 días)
Ashkan Rigi
Ashkan Rigi el 24 de Oct. de 2021
Editada: Image Analyst el 24 de Oct. de 2021
Here is my code sample:
t=[0,4,8,12,16,20];
y=[0.7,0.9,0.9,0.7,0.3,0];
for i=1:length(t)
u=[t(i) t(i+1) t(i+2)];
v=[y(i) y(i+1) y(i+2)];
i=i+3;
end

Respuesta aceptada

Image Analyst
Image Analyst el 24 de Oct. de 2021
Yes, you get new u and v vectors every time - is that what you mean by successive? By the way you should do it this way:
t = [0,4,8,12,16,20]
y = [0.7,0.9,0.9,0.7,0.3,0]
for k = 1 : 3 : length(t)-2
% Get a new u and v for this iteration:
u = t(k : k+2);
v = y(k : k+2);
% Now do something with u and v....
end

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by