swh:1:snp:3a35cdb24ad67a89d2a1abf099040aff3c71b7b4
Tip revision: c4ecf78f32558cba5e45ab0c43a0995a20f2c85b authored by igkiou on 05 September 2019, 11:00:35 UTC
first commit
first commit
Tip revision: c4ecf78
farFieldCov.m
%% Build far field covariance matrix
% Build the target area
boxTargetArea = boxArea( ...
1 , ... wavelength
10, ... MFP (O.D. = 2)
[-10,10], ... z
[-10,10] ... x
);
% views config, define by angles
viewsDirections = 0:1:359;
views = farFieldSource(deg2rad(viewsDirections),0);
% lights config, lighting in some directions
lightsDirections = [0, 1, 4, 20];
lights = farFieldSource(deg2rad(lightsDirections),0);
% scatter config
% load measured amplitude (generated by mu-diff far field)
load('scatteringAmplitude.mat', 'theta', 'farField')
scatter = tabulatedAmplitudeScatter( ...
theta, ... diirections
farField ... measured amplitude
);
% Show the scattering function
figure
polarplot(theta, abs(farField).^2);
title('Scattering function of single particle')
%% Sovle scmc with CBS
tic
CBSres = scmc(boxTargetArea,views,lights,scatter,1e3,'CBS',true,'parforIters',12);
toc
%% Sovle scmc without CBS
tic
NCBSres = scmc(boxTargetArea,views,lights,scatter,1e3,'CBS',false,'parforIters',12);
toc
%% Compare cov matrix
f = figure;
f.Position = [0,0,1200,700];
maxval = max(abs([CBSres.C(:);NCBSres.C(:)]));
subplot(2,4,1);
imagesc(viewsDirections,viewsDirections,abs(CBSres.C(:,:,1,1)),[0,maxval]);
xlabel('view[deg]');
ylabel({'CBS','view[deg]'});
title(['(',num2str(lightsDirections(1)),'\circ,',num2str(lightsDirections(1)),'\circ)']);
subplot(2,4,2);
imagesc(viewsDirections,viewsDirections,abs(CBSres.C(:,:,1,2)),[0,maxval]);
xlabel('view[deg]');
ylabel('view[deg]');
title(['(',num2str(lightsDirections(1)),'\circ,',num2str(lightsDirections(2)),'\circ)']);
subplot(2,4,3);
imagesc(viewsDirections,viewsDirections,abs(CBSres.C(:,:,1,3)),[0,maxval]);
xlabel('view[deg]');
ylabel('view[deg]');
title(['(',num2str(lightsDirections(1)),'\circ,',num2str(lightsDirections(3)),'\circ)']);
subplot(2,4,4);
imagesc(viewsDirections,viewsDirections,abs(CBSres.C(:,:,1,4)),[0,maxval]);
xlabel('view[deg]');
ylabel('view[deg]');
title(['(',num2str(lightsDirections(1)),'\circ,',num2str(lightsDirections(4)),'\circ)']);
subplot(2,4,5);
imagesc(viewsDirections,viewsDirections,abs(NCBSres.C(:,:,1,1)),[0,maxval]);
xlabel('view[deg]');
ylabel({'Without CBS','view[deg]'});
subplot(2,4,6);
imagesc(viewsDirections,viewsDirections,abs(NCBSres.C(:,:,1,2)),[0,maxval]);
xlabel('view[deg]');
ylabel('view[deg]');
subplot(2,4,7);
imagesc(viewsDirections,viewsDirections,abs(NCBSres.C(:,:,1,3)),[0,maxval]);
xlabel('view[deg]');
ylabel('view[deg]');
subplot(2,4,8);
imagesc(viewsDirections,viewsDirections,abs(NCBSres.C(:,:,1,4)),[0,maxval]);
xlabel('view[deg]');
ylabel('view[deg]');
%% Compare diagonals
figure
hold on
plot(viewsDirections,diag(abs(CBSres.C(:,:,1,1))), 'lineWidth', 2);
plot(viewsDirections,diag(abs(NCBSres.C(:,:,1,1))), 'lineWidth', 2);
xlabel('view[deg]');
ylabel('intensity');
legend('With CBS','Without CBS')