Operator '>' is not supported for operands of type 'tf'
3 次查看(过去 30 天)
显示 更早的评论
%% 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'
0 个评论
采纳的回答
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 个)
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
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:
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!