フィルターのクリア

Unrecognized function or variable 'uu'. Error in 'TBSv1/desired trajectory' while evaluating expression.

1 回表示 (過去 30 日間)
I have a block taking input as only time, but the error keeps poping up,
How to solve this error? My code works fine if i use Matlab function instead of integrated matlab function.
here is the code in the block for reference
function out=DesiredTrajectory(uu,P)
t=uu;
ytraj= [8;8;20];
ydottraj= [0;0;0];
yddottraj= [0;0;0];
out=[...
ytraj;...
ydottraj;...
yddottraj];
  5 件のコメント
Twinkle Patel
Twinkle Patel 2020 年 6 月 19 日
P is just the parameter, well the "t" here is there to be used for some cases like below
if t > 20
ytraj= [5 ; 10 ; 5];
ydottraj= [0;0;0];
yddottraj= [0;0;0];
end
Walter Roberson
Walter Roberson 2020 年 6 月 19 日
Please attach your model for testing.

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

回答 (1 件)

Mara
Mara 2020 年 6 月 18 日
If you call this function, you need two inputs inside the bracket:
out = DesiredTrajectory(uu, P)
It sounds to me like you might have uu in your workspace, so the code runs fine when you evaluate the selection. But when you call a function, it does not have access to that. It only has access to the variables that you give it as an input, in this case uu and P.
Maybe try to check it. Put a breakpoint at the line t = uu and see if uu appears in the workspace.
Hope I could help!
  3 件のコメント
Mara
Mara 2020 年 6 月 18 日
Alright, I am sorry but I cannot help you with this. As far as I understood, the problem is not the function but the code from where you call it. I wish you good luck

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by