MATLAB Examples

Contents

filename = 'Forest.tif';
F = imread(filename);
Fivh = double(F(:,:,1)); % inphase VH
Fqvh = double(F(:,:,2)); % Quadphase VH
Fivv = double(F(:,:,3)); % inphase VV
Fqvv = double(F(:,:,4)); % Quadphase VV
Fihh = double(F(:,:,5)); % inphase HH
Fqhh = double(F(:,:,6)); % Quadphase HH
Fihv = double(F(:,:,7)); % inphase HV
Fqhv = double(F(:,:,8)); % Quadphase HV

Vectorization

Reshape from Matrix to Vector for Scatter Plot

[Fivh1] = mat2vec(Fivh);
[Fqvh1] = mat2vec(Fqvh);
[Fivv1] = mat2vec(Fivv);
[Fqvv1] = mat2vec(Fqvv);
[Fihh1] = mat2vec(Fihh);
[Fqhh1] = mat2vec(Fqhh);
[Fihv1] = mat2vec(Fihv);
[Fqhv1] = mat2vec(Fqhv);

Histograms

figure
% [ax,h]=subtitle('Histogram of Cross and Co Pol Channels with with fitted Gaussian Dist');
subplot(2,2,1)
histfit(Fivh1);
title ('Normal fit of Histogram for I-VH');
subplot(2,2,2)
histfit(Fqvh1);
title ('Normal fit of Histogram for Q-VH');
subplot(2,2,3)
histfit(Fihv1);
title ('Normal fit of Histogram for I-HV');
subplot(2,2,4)
histfit(Fqhv1);
title ('Normal fit of Histogram for Q-HV');

Quantitaive KLD Analysis with normal PDFs

[KdFivh]= kldcmpnorm(Fivh1,1000000);
[KdFqvh]= kldcmpnorm(Fqvh1,1000000);
[KdFivv]= kldcmpnorm(Fivv1,1000000);
[KdFqvv]= kldcmpnorm(Fqvv1,1000000);
[KdFihh]= kldcmpnorm(Fihh1,1000000);
[KdFqhh]= kldcmpnorm(Fqhh1,1000000);
[KdFihv]= kldcmpnorm(Fihv1,1000000);
[KdFqhv]= kldcmpnorm(Fqhv1,1000000);

writing results

Kd = [KdFivh KdFqvh KdFivv KdFqvv KdFihh KdFqhh KdFihv KdFqhv];
fprintf('%d',Kd);
outfile = 'KLDresults';
head= ' IVH    QVH   IVV     QVV    IHH     QHH    IHV    QHV';
Summary = 'This file contains the KLD estimates of I and Q components \n for the 4 channels with normal fit of I and Q components ';
Title = 'KLD I & Q Components with Normal fitted I and Q components';
dlmwrite(outfile, Title, ...
    'newline', 'pc','delimiter', ' ');
dlmwrite(outfile, Summary, '-append', ...
    'newline', 'pc','delimiter', ' ');
dlmwrite(outfile, head, '-append', ...
    'newline', 'pc','delimiter', ' ');
dlmwrite(outfile, Kd, '-append', ...
    'newline', 'pc','delimiter', ' ');
head
Kd
1.141749e+011.135802e+018.767179e+008.941968e+008.804465e+008.744500e+001.144387e+011.151107e+01
head =

 IVH    QVH   IVV     QVV    IHH     QHH    IHV    QHV


Kd =

  Columns 1 through 7

   11.4175   11.3580    8.7672    8.9420    8.8045    8.7445   11.4439

  Column 8

   11.5111