# Demo entry 1070158

hallo

Submitted by hallo on Jan 14, 2015 at 03:00
Language: Matlab. Code size: 1.5 kB.

```%%% CALCULATION OF K c
clear all; close all;

%% Important values
umr=0.162e-6; % factor for calculation in meter
r0=mean (mean (DetEdge*umr)); % mean radius
T=293; % Temperature (20n[Degree]C)
kb=1.3806488e-23; % Boltzmann constant

%% Fouriertransform of the relative amplitude
u=(DetEdge)*umr/r0-1; % relative amplitude
L=length (phi4unwrap); % length of the angle vector
for k=1:500

% Fourier-Transform

% (absolute value squared)

uq (:,k)=(abs (ifft (u (:,k))).^2);

% calculation of the mean of the squared absolutum

for i=1:L
mean_uq (i)=mean (uq (i,:));
end
end

% Plot of results

figure (1);
plot (mean_uq,'xk')
xlabel ('wave number \$q\$','interpreter','latex','FontSize',14)
ylabel ('mean square amplitude \$<|u_{q}|^{2}>\$','interpreter','latex','FontSize',14)
axis tight

%% Legendre polynomials and sum arguments

for q=2:25
for l=q:25
Pql=legendre (l,0); % legendre polynomials for a certain l
P (q,l)=Pql (q+1); % chose the q-th mode value in that vector
s (q,l)=(2*l+1)/(4*pi)*factorial (l-q)/factorial(l+q)*P (q,l)^2/((l-1)*(l+2)*l*(l+1));

% calculate each summand

end

% Summation per q:

sadd (q)=sum (s (q,:)); % s is a diagonal matrix, because the sum

% always starts at l=q. The summation is not
% altered by this because the addition of zero
% does not change the outcome.
% Finally: calculation of k c depending on the wave vector q:

kc (q)=kb*T/(mean_uq (q+1))*sadd (q);
end
kc=kc';
save ('kc.mat','kc')
```

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.