How can I define successive vectors by matlab?

1 回表示 (過去 30 日間)
Ashkan Rigi
Ashkan Rigi 2021 年 10 月 24 日
編集済み: Image Analyst 2021 年 10 月 24 日
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

採用された回答

Image Analyst
Image Analyst 2021 年 10 月 24 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by