Operator '>' is not supported for operands of type 'tf'
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
%% 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 commentaires
Réponse acceptée
Paul
le 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
Plus de réponses (1)
Image Analyst
le 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 commentaires
Image Analyst
le 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:
Voir également
Catégories
En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!