Not able to run a code given in documentation of tf function

I am trying to use the 'tf' function to get a transfer function however something seems to be wrong as I am just not able to use the function without an error about index popping up. I even tried this code given in the examples in documentation of the 'tf' function:
numerator = 1;
denominator = [2,3,4];
sys = tf(numerator,denominator)
And I get the error: Index in position 2 exceeds array bounds (must not exceed 1).
Can someone please help me? This is frustrating.

 채택된 답변

madhan ravi
madhan ravi 2020년 6월 18일
clear tf

댓글 수: 4

I really cannot thank you enough! I am curious as to how did you know this? This seems like something I would have never figured this out myself. Is it your experience and knowledge or is it there in some documentation?
You by mistake named a variable tf , so you see how much of a pain it gives ya ;)
This is a fairly common mistake (it often happens with sum and image), so it is a reasonable guess given the error message.
You can check for things like this with the which command:
clc,clear
which tf -all
fprintf('\n And now again with a variable in the workspace:\n\n')
tf=0;
which tf -all
Ah okay. Thank you madhan and Rik.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

제품

릴리스

R2018a

질문:

2020년 6월 18일

댓글:

2020년 6월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by