필터 지우기
필터 지우기

Operator '>' is not supported for operands of type 'tf'

조회 수: 3 (최근 30일)
Salah
Salah 2023년 1월 7일
댓글: Salah 2023년 1월 7일
%% w1 ,w2 ,X1, X2, X3, X4, X5, u1, u2, u3, y1, y2, y3, y4 are defined variables i did not put them to make the question short
s=tf('s')
Gvd = (Vo*(s*w1 + w2)*((s^4)*x1+(s^3)*x2+(s^2)*x3+s*x4+x5))/(dp*((s^2)*u1+s*u2+u3)*((s^3)*y1+(s^2)*y2+s*y3+y4));
d = Gvd>0;
values = Gvd(d);
objective = -20*log(values);
Operator '>' is not supported for operands of type 'tf'

채택된 답변

Paul
Paul 2023년 1월 7일
Hi Salah
Gvd is a transfer function. It looks like you want to evaluate Gvd at a set of frequencies and then operate on that result.
Use freqresp to evaluate Gvd at the frequencies of interest and then compute the objective. Something like this
omega = logspace(-1,3,100);
H = freqresp(Gvd,w);
f = -20*log10(abs(H)); % as defined in Presentation1.pdf, though f is a function of omega, not x
  댓글 수: 1
Salah
Salah 2023년 1월 7일
Thanks a lot Paul, it worked!
Much appreciation.

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

추가 답변 (1개)

Image Analyst
Image Analyst 2023년 1월 7일
"i did not put them to make the question short" <= that was a mistake. Now you are forcing us to assign variables to them if we want to test it. Most people won't do that. If even you don't want to put in the work, then they won't either.
If Gvd(d) is true or false you don't want to do d = Gvd>0 to just give another true or false variable. And then taking the log of a vector of true or false values is nonsense.
  댓글 수: 3
Image Analyst
Image Analyst 2023년 1월 7일
I don't know that I answered it, but if I did, thanks for accepting it. For people to run your code they need to know what you passed into the function. What are Lc, Cc, Lf, and Cf?
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
Salah
Salah 2023년 1월 7일
Sorry , i am new to the MATLAB community and its my first time trying to ask a qeustion here, i accepted your answer because logically you are correct, but i want to eleminate all the values that causing the problem, firstly i used the function 'abs' because its in the objective function but the same problem appears that 'abs' is not supported for 'tf' , so i changed it to y=Gvd>0, because the domain of the log is from (zero to infinity) but the same problem occured. All the information of this code are attached in the pdf file. My apologies again for any inconvenience.

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

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by