error running sys=tf()
12 次查看(过去 30 天)
显示 更早的评论
Hi,
i wa having trouble running sys=tf() resulting in an error and the line the code is in displaying in my command window. My code is below. Could you help me?
Y=10;
U= [1,3,10];
sys= tf(Y,U);
[y,t]=impulse(sys,5);
plot(t,y);
xlabel('Time (s)');
ylabel('Amplitude');
title('Problem 3');
grid on;
command window
Error in prob3 (line 3)
sys= tf(Y,U);
Resolved:
Apparently I didn't have the controls toolbox downloaded.
2 个评论
Dave B
2021-9-9
编辑:Dave B
2021-9-9
This seems to run okay to me, is it possible that you have a tf variable defined? Or maybe a different tf function on your path (which tf should report matlab\toolbox\control\ctrlmodels)? clear all might be helpful. Or maybe you don't have this toolbox? I don't see what the error is, did MATLAB not give a little more info?
Y=10;
U= [1,3,10];
sys= tf(Y,U);
[y,t]=impulse(sys,5);
plot(t,y);
xlabel('Time (s)');
ylabel('Amplitude');
title('Problem 3');
grid on;
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
