optimization problem for exponential coefficients

1 vue (au cours des 30 derniers jours)
fima v
fima v le 24 Mar 2024
Commenté : fima v le 29 Mar 2024
Hello , i have the attached code which produces certain radiation pattern shown below.
basicly in matlab view its AF,theta plot.
In in code the coeeficients of real_voltage phases are known, however i want to create a code which given AF,theta it whould return me the best optimized real_voltage phases coefficients.
Thanks.
theta=linspace(-pi/2,pi/2,1000);
f=5.6;
N=6;
lambda=300/f;
d=0.8*lambda;
theta_0=pi*((0)/180);
amplitude_norm_V=[0.05,0.3,0.75,1,0.75,0.3,0.05];
k=(2*pi)/lambda;
delta=k*d*cos(theta_0);
x=sqrt(1/(sum(amplitude_norm_V.^2)));
real_voltage=amplitude_norm_V.*x;
real_power=(real_voltage.^2);
sum(real_power);
phases=[0,0,0,0,0,0,0];
total=0;
tot=0;
for z=1:6
AF=real_voltage(z)*exp(1i*(phases(z)/180*pi))*exp(-1i*(z-1)*k*d*cos(theta)+1i*(z-1)*delta);
total=total+AF;
end
plot((theta/pi)*180,20*log10(total)), grid on
Warning: Imaginary parts of complex X and/or Y arguments ignored.

Réponses (1)

Morgan
Morgan le 25 Mar 2024
This sounds like a non-linear regression problem if I'm understanding your question correctly.
The function you're fitting to looks like:
Use fitnlm() and how to use fitnlm() to solve for the best fit coefficients in your case.
  3 commentaires
Morgan
Morgan le 26 Mar 2024
Modifié(e) : Morgan le 26 Mar 2024
% NUMBER OF FIT PARAMETERS
N = 6;
% THETA ARRAY
theta = linspace(-pi/2,+pi/2,1000);
% V DATA
V = ... % Your data for V that has length of N
% AF DATA
AF = ... % Your data for AF the same size as theta
% COEFFICIENT GUESS
beta0 = zeros(1,N);
% SOLVE NONLINEAR REGRESSION MODEL
mdl = fitnlm(theta,AF,@(b,theta) modelfun(b,theta,V),beta0)
% FUNCTION MODEL
function y = modelfun(b,theta,V)
y = 0;
for n = 1 : length(V)
y = y + V(n)*exp(1i*b(n))*exp(1i*(n-1)*(delta - k*d*cos(theta)));
end
end
fima v
fima v le 29 Mar 2024
Hello, what is my expression has not jus V but also phases.How does the code will change then?
Thanks.

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by