Coding help needed to optimize my 3*3 Diagonal matrix with GA.
이전 댓글 표시
Hi. I am working on antenna design and for optimization of reactive elements or we can say to find the best parasitic reactance, I am using GA in Matlab. I looked at various resources but my problem is little different and haven't addressed earlier. I have tried below to explain my algorithm with the use of Matlab code it self.
clc;
clear all;
j = sqrt(-1);
c = 3*10^8;
f = 10^9;
lambda = c/f;
d = lambda/2;
h = lambda/2;
display(c);
display(f);
display(lambda);
display(d);
display(h);
z11 = 78.1+(j*35.5);
z12 = 96.8+(j*66.139);
z13 = 60.0824+(j*42.95);
Z_A = [z11 z12 z13; z12 z11 z12; z13 z12 z11]; % Antenna Impedance
display(Z_A);
Z_L = [j*x_1 0 0; 0 50+j*x_2 0; 0 0 j*x_3]; % Load Impedance
display(Z_L);
Z_T = [Z_A] + Z_L;
V = [0;
1;
0];
I = inv(Z_T)*V;
display(I);
display(fval);
In this code I am trying to find the minimum I by optimizing x1,x2 and x3. What I am trying is somehow I can generate x1, x2, x3 and then run GA over and over again on the same program until I get minimum I with my fitness function being
y = -((abs(I(1)-I(2))^2) + (abs(I(3)-I(2))^2));
If anyone has done something related to it or willing to help. your help would be much appreciated and If I write a paper I will surely acknowledge them.
댓글 수: 7
Walter Roberson
2016년 3월 28일
편집: Walter Roberson
2016년 3월 28일
You should avoid using inv(). Instead of
I = inv(Z_T)*V;
you should use
I = Z_T\V;
Are your x1, x2, x3 intended to be real-valued or complex valued? Are they intended to be real and non-negative? Do they have a maximum?
guru
2016년 3월 28일
Walter Roberson
2016년 3월 28일
None of the optimizers, including ga(), are designed to search over complex values. Any variable that is intended to be complex should be split into two variables, one for the real portion and one for the complex portion; you can then combine the two inside the objective function.
guru
2016년 3월 29일
Walter Roberson
2016년 9월 14일
Instead of (for example)
x(1).^2 - 3 * x(2)
where x(1) is complex, you would break it up into two variables
(x(1)+1i*x(3)).^2 - 3 * x(2)
Depending on the expression, you might be able to simplify the calculation after you do that; for example if there is a imag(x(1)) sub-expression in the original, you could replace that with x(3) directly instead of with imag(x(1)+1i*x(3))
guru
2016년 9월 14일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Design, Analysis, Benchmarking, and Verification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!