- #1
member 428835
Hi PF!
I'm trying to compute $$S_i(\theta) = \sum_{m=odd}^{N}\frac{64}{\pi^3 m \alpha}\frac{k^2}{4k^2-m^2} \sum_{l=0}^N J_l(\alpha m) \xi_l \left( B_l(\theta)\cos(l\theta)+C_l(\theta)\sin(l\theta) \right)$$ where the ##i## subscript appears since $$B_l = \int_0^{2\pi} \psi_i(\theta) \cos(l\theta)\,d\theta \\ C_l = \int_0^{2\pi} \psi_i(\theta) \sin(l\theta)\,d\theta.$$ Once obtaining ##S_i## I'm trying to compute $$[M]:M_{ij} = \int_0^{2\pi}S_i\psi_{j} \, d\theta.$$ Can you confirm that this code computes that? I'm driving myself crazy here. In the code below I call ##S_i## "Mop".
I'm trying to compute $$S_i(\theta) = \sum_{m=odd}^{N}\frac{64}{\pi^3 m \alpha}\frac{k^2}{4k^2-m^2} \sum_{l=0}^N J_l(\alpha m) \xi_l \left( B_l(\theta)\cos(l\theta)+C_l(\theta)\sin(l\theta) \right)$$ where the ##i## subscript appears since $$B_l = \int_0^{2\pi} \psi_i(\theta) \cos(l\theta)\,d\theta \\ C_l = \int_0^{2\pi} \psi_i(\theta) \sin(l\theta)\,d\theta.$$ Once obtaining ##S_i## I'm trying to compute $$[M]:M_{ij} = \int_0^{2\pi}S_i\psi_{j} \, d\theta.$$ Can you confirm that this code computes that? I'm driving myself crazy here. In the code below I call ##S_i## "Mop".
Code:
for ii = 1:2*N-1
for mm = 1:2:N
for l = 0:N
J = 2*besseli(l,alpha*mm)/(besseli(l-1,alpha*mm)+besseli(l+1,alpha*mm));
B = trapz(psi(ii,:).*cos(l.*theta))*dtheta;
C = trapz(psi(ii,:).*sin(l.*theta))*dtheta;
Mop1 = Mop1+xi(l+1)*J*(B*cos(l*theta)+C*sin(l*theta));
end% for l
Mop(ii,:) = Mop(ii,:) + 64/(pi^3*mm*alpha)*(k^2/(4*k^2-mm^2))*Mop1;
Mop1 = zeros(1,size(Mop1,2));% clear previous Mop1 data
end% for mm
for jj = 1:2*N-1
M(ii,jj) = trapz(Mop(ii,:).*psi(jj,:))*dtheta;% eq. (2.24b)
end% for jj
end% for ii