hello, I am trying to evaluate a summation series from n=1:1:400. The expression inside the summation needs to be evaluated for various inputs L=0.5:0.1:3 and alpha=0:0.1:1. can any one help?thank you.
1 次查看(过去 30 天)
显示 更早的评论
the summation is (sum of all terms from n=1 to n=4000): q_loss(L,alpha)=-2∑Real((Q_n/2.π.n.j)*(1- .e^(2.π.n.j.alpha)) in which Q-n is given by: Q_n=(P_H (1-e^(-2.j.π.n.alpha) )+P_L (e^(-2.j.π.n.alpha)-e^(-2.j.π.n) ))/(2.π.n.j(j.Z_o.Zi.tan(w.L.zi/c)+R_v )). I would be grateful for any help. Thank you
1 个评论
Abraham Boayue
2018-3-14
Check this code out. It might be useful, let me know if it works, if not, let me know what's wrong and we can fix it together.
采纳的回答
Abraham Boayue
2018-3-14
clear varianles;
close all;
n = 1:400;
L = 0.5:0.04:3;
alpha = 0:0.04:1;
N = length(n);
M = length(L);
C = length(alpha);
% Define constants (Just my test values)
w = 0.45;
c = 2.8;
Rv = 3.5;
Zo = 2;
Zi = 4;
Ph = 4.5;
Pl = 6.3;
[alpha,L] = meshgrid(alpha,L);
Q = zeros(M,C);
% code seem to be wirking well,but since
% I have no idea what your function represents,
% I dont know what to expect. check it yourself
% and see. I may have defined some variables
% wrongly, varify the equations for the qs.
for i = 1:N
phi = i*2*pi*n(i);
q1 = Ph*(1-exp(-phi*alpha));
q2 = Pl*(exp(-phi*alpha)-exp(-phi));
q3 = phi*(i*Zo*Zi*tan(w*Zi*L)/c)+Rv;
Qn = (q1+q2)./q3;
qn = 1-exp(-phi*alpha);
Q = Q + real(Qn.*qn/phi);
end
figure(1)
surf(alpha,L,Q)
figure(2)
plot(Q,'linewidth',2)
grid
a = title('qloss(alpha,L)');
set(a,'fontsize',14);
a = ylabel('q');
set(a,'Fontsize',14);
a = xlabel('alpha,L');
set(a,'Fontsize',14);
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!