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

6 views (last 30 days)
%% 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'

Accepted Answer

Paul
Paul on 7 Jan 2023
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

More Answers (1)

Image Analyst
Image Analyst on 7 Jan 2023
"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 Comments
Image Analyst
Image Analyst on 7 Jan 2023
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 on 7 Jan 2023
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.

Sign in to comment.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!