0
$\begingroup$

I want to optimize the below function with GA(genetic algorithm): $$ \min_{l_{x_1},l_{x_2},l_d}||S_QS(z)||_2 $$

$S_Q$ and S(z) are defined as: $$ S_Q=\Biggm[\matrix{6.6549 &-0.806&6.883\cr -0.806 &12.146 &6.818\cr 6.883 &6.818 &29.071}\Biggm] $$ $$ S(z)=\Biggm[\matrix{z-1-l{x_1}&-0.05&-1 \cr -l{x_2}&z-1&-1\cr -l_d &0 &z-1}\Biggm]^{-1} $$ where z is the z-transform variable

I write below code and using optimization toolbox in MATLAB

function z=objective_function(o)
lx1=o(1);
lx2=o(2);
ld=o(3);
Sq=[6.6549,-0.806,6.883;
    -0.806,12.146,6.818;
    6.883, 6.818,29.071]
z=tf('z')
s=[z-lx1-1,-0.05,-1;-lx2,z-1,-1;-ld,0,z-1]
z=norm(Sq*inv(s));
end

but do not work and give me that error (The "norm" command cannot compute the H2 norm of improper discrete-time models)

$\endgroup$
4
  • 1
    $\begingroup$ Hi welcome to engineering. This looks like homework. Please show your efforts to solve this. $\endgroup$ – NMech Mar 11 at 9:46
  • $\begingroup$ I added the code I wrote and this problem relates to my Thesis. I appreciate it if you help me. $\endgroup$ – user212662 Mar 11 at 12:29
  • $\begingroup$ Not an answer, but in matlab it is better to use backslash instead of calculating the inverse separately, so Sq / s instead of Sq*in(s). Is should be faster and more accurate. $\endgroup$ – fibonatic Mar 11 at 13:11
  • $\begingroup$ Your optimization problem also seems to be note well enough defined, since $z$ seems to still be a free variable and thus the objective function can't be evaluated numerically. $\endgroup$ – fibonatic Mar 11 at 13:14
2
$\begingroup$

Taking the norm of a system is something different that taking the norm of a matrix. Luckily, matlab has you covered: https://nl.mathworks.com/help/control/ref/lti.norm.html

This page even shows an example in discrete time. However, what I think is missing in your example is that you should provide a sampling time. As the norm is calculated for every value of $z$ (I believe it is something like the integral of the trace of the absolute value of the system for every $e^{jw}$), the sampling time should be included. I'd recommend first testing if z=tf('z', -1); works, but otherwise specify a generic sampling rate.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.