I need help writing a function with one input and one output

4 ビュー (過去 30 日間)
Amanda
Amanda 2022 年 11 月 17 日
コメント済み: Amanda 2022 年 11 月 17 日
Im trying to write a function 'walk'. My input is 'number_of_steps' and my output is 'steps_made_successfully'. Im trying to instruct my robot to take a 'number_of_steps' and it return how many 'steps_made_successfully' before the robot would run into a wall. This is what I have so far but I dont know what I'm doing.

回答 (1 件)

Jim Riggs
Jim Riggs 2022 年 11 月 17 日
編集済み: Jim Riggs 2022 年 11 月 17 日
The syntax for defining a function is:
function steps_made_sucessfully = walk(commanded_steps)
% insert your code here
% ...
steps_made_sucessfully = .. % make sure that the output parameter is always defined
end
  1 件のコメント
Amanda
Amanda 2022 年 11 月 17 日
i don't know what code to write for it

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by