フィルターのクリア

I need help writing a program that makes the ball move along the path.

3 ビュー (過去 30 日間)
John Polo
John Polo 2020 年 10 月 23 日
コメント済み: Rena Berman 2021 年 5 月 7 日
This is what my codes look likes:
clear all
clc
close all
createWindow(300,600);
obj = drawBall(0,300,5,'y');
x = 0:1:300;
y = 50 * sin(x/(10*pi)) + 100
plot(x,y)
for k = 1:x
xMove(obj,1)
yMove(obj,ystep)
redraw
end
Please help me figure out the ystep. I have no idea how to do it. Thanks in advance!
  3 件のコメント
Stephen23
Stephen23 2020 年 10 月 24 日
John Polo's orginal question retrieved from Google Cache:
I need help writing a program that makes the ball move along the path.
This is what my codes look likes:
clear all
clc
close all
createWindow(300,600);
obj = drawBall(0,300,5,'y');
x = 0:1:300;
y = 50 * sin(x/(10*pi)) + 100
plot(x,y)
for i = 1:x
xMove(obj,1)
yMove(obj,ystep)
redraw
end
Please help me figure out the ystep. I have no idea how to do it. Thanks in advance!
Rena Berman
Rena Berman 2021 年 5 月 7 日
(Answers Dev) Restored edit

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2020 年 10 月 23 日
for k = 1:length(x)-1
xstep = x(k+1)-x(k);
xMove(obj, xstep)
ystep = y(k+1)-y(k);
yMove(obj, ystep)
redraw
end

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by