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!