필터 지우기
필터 지우기

Unable to use a value of type tf as an index. How to fix?

조회 수: 28 (최근 30일)
Rohan Gulur
Rohan Gulur 2024년 1월 3일
댓글: Rohan Gulur 2024년 1월 3일
num=[(-number1),(number2)];
den=[(number3), (number4))];
sys1 = tf(num, den);
fb = bandwidth(sys1)
Having issues when running this saying that I am unavailable to use value of TF as an index. Any suggestions to fix this?

채택된 답변

Walter Roberson
Walter Roberson 2024년 1월 3일
You will find that bandwidth is a variable but that you are trying to use it as a function call.
  댓글 수: 2
Rohan Gulur
Rohan Gulur 2024년 1월 3일
Hi Walter, how else would I use bandwidth then?
Steven Lord
Steven Lord 2024년 1월 3일
Rename the variable you've created that's named bandwidth to something else. While that variable exists in the workspace you will be unable to call the bandwidth function.

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

추가 답변 (1개)

Ayush
Ayush 2024년 1월 3일
The error message "Unable to use a value of type tf as an index" suggests that there is a syntax error in the code. It seems like there is an extra parenthesis in the den array definition which is causing the problem.
You can try this code:
number1 = ...; % Your value for number1
number2 = ...; % Your value for number2
number3 = ...; % Your value for number3
number4 = ...; % Your value for number4
num = [-number1, number2];
den = [number3, number4];
sys1 = tf(num, den);
fb = bandwidth(sys1);
Thanks,
Ayush
  댓글 수: 1
Rohan Gulur
Rohan Gulur 2024년 1월 3일
It was an issue with my variables in the work space - sorry for the confusion

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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by