Too Many Output Arguments

2 ビュー (過去 30 日間)
Jacob Hammer
Jacob Hammer 2018 年 4 月 25 日
編集済み: Walter Roberson 2018 年 4 月 25 日
Hi! I am receiving this error code:
Error using comet
Too many output arguments.
Error in FeedbackControlSystem1 (line 75)
SystemTrack_1 = comet(t,c);
for this code:
t = linspace(0,60,360000);
Z = 0.1;
W_n = 2.5;
B = sqrt(1 - Z^2);
Theta = atan(B/Z);
c = 1 - ((1/B) * (exp(1) .^ -(Z * W_n .* t)) .* (sin(B * W_n .* t + Theta)));
SystemResponse_1 = plot(t,c);
title('System Response Over a Minute');
xlabel('Time (seconds)');
ylabel('System Response');
% Trace the Response of the system using comet
SystemTrack_1 = comet3(t,c);
title('System Response Tracker Over a Minute');
xlabel('Time (seconds)');
ylabel('System Response');

採用された回答

Ameer Hamza
Ameer Hamza 2018 年 4 月 25 日
You will need to use comet instead of comet3, because you have two variables t and c. Additionally, the function comet does not return an output argument. You need to call it like this.
comet(t,c); % not like: SystemTrack_1 = comet(t,c);
If you still want handles to the graphics object, you can do this
ax = gca;
handles = ax.Children

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 4 月 25 日
編集済み: Walter Roberson 2018 年 4 月 25 日
Your error message is about comet() but your code is about comet3()
Neither comet() nor comet3() return values.
In the current implementation, comet() creates a line() object and two animatedLine() objects and plays them through and then returns. The line() and animatedLine()s are left sitting in the axes, but the handles to them are not returned.
Note that there is nothing like a "play" method for comet(): it runs through the complete cycle before returning. Therefore although you can get the handles to the objects afterwards, if you wanted the handles in order to legend() them, then you would be labeling with respect to objects that are already static by the time you get them.

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by