Code covered by the BSD License  

Highlights from
GTL jetfuel_ternplot with neural network

image thumbnail

GTL jetfuel_ternplot with neural network

by

 

This is an upgrade of the ternplot code written by Carl Sandrock (ID#2299).

gtl(u)
function u = gtl(u)
if u<37;
    time = 37;
    fprintf('please wait for %d seconds. time = %d \n', time, u);
else
    eml.extrinsic('figure','subplot','ternplot','ternlabel','terncontour','ternpcolor','shading')
    int(sym('k'));
    syms('Density','HeatContent','FlashPoint','FreezingPoint');
    load -mat experimental.mat input;
    load -mat data.mat output;
    k=1;
    experimental=input';
    experimental(:,1)=[];
    %avg=[0.883,44.3,61,-77];
    data=output';
    data(:,1)=[];
    for j=1:1:4
        data(:,j)=data(:,j);     %.*avg(1,j);
    end
    data
    A = experimental(:, 1)'/100;
    B = experimental(:, 2)'/100;
    C = experimental(:, 3)'/100;
    [fA, fB, fC] = fractions(A, B, C);
    max=[0.840,45.5544,63.4,-40];
    min=[0.775,43,50,-76];
    [a,b]=size(data);
    m = zeros(a,b);
    n=m;
    for i=1:1:b
        for j=1:1:a
            m(j,i)=data(j,i)>min(1,i);
            n(j,i)=data(j,i)<max(1,i);
        end
    end
    opt=data.*(m.*n);
    trn = experimental;
    p=1;
    d=1;
    while p<=d
        if sum(opt(p,:))==0
            opt(p,:)=[];
            trn(p,:)=[];
            [d e]=size(opt);
            p=1;
        else p=p+1;
        end
    end
    D = trn(:, 1)';
    E = trn(:, 2)';
    F = trn(:, 3)';
    [fD, fE, fF] = fractions(D, E, F);
    nam={'Density','Heat Content','Flash Point','Freezing Point'};
    while k <= 4
        figure
        subplot(2, 2, 1)
        ternplot(fA, fB, fC, '.'); ternlabel('I-P', 'N-P', 'C-P', nam(1,k));
        subplot(2, 2, 2)
        terncontour(fA, fB, fC, data(:,k)); ternlabel('I-P', 'N-P', 'C-P', nam(1,k));
        subplot(2, 2, 3)
        ternpcolor(fA, fB, fC, data(:,k)); ternlabel('I-P', 'N-P', 'C-P', nam(1,k));
        shading interp
        k=k+1;
    end
    k=1;
    while k <= 4
        figure
        ternpcolor(A, B, C, data(:,k)); ternlabel('I-P', 'N-P', 'C-P', nam(1,k));
        shading interp
        h = axes('Position', [0.179 0.11 0.8 0.785], 'Layer','bottom'); 
        terncontour(D, E, F, opt(:,k)); 
        shading interp
        axis(h, 'off', 'equal', 'tight');
        colorbar;
        k=k+1;
    end


figure
terncontour(D, E, F, opt); 
ternlabel('I-P', 'N-P', 'C-P', 'Optimized Plot');
hold on
ternplot(D, E, F, '*');
hold off
colorbar;
%hcb=colorbar('YTickLabel',{'�C','g/mL','MJ/Kg'});
%set(hcb,'YTickMode','manual')

k=1;
figure
while k <= 4
    ternpcolor(D, E, F, opt(:,k)); 
    ternlabel('I-P', 'N-P', 'C-P', 'Optimized Plot');
    shading interp
    hold on
    ternplot(D, E, F, '*'); 
    ternlabel('I-P', 'N-P', 'C-P', 'Optimized Plot');
    shading interp
    hold on
    terncontour(D, E, F, opt(:,k)); 
    ternlabel('I-P', 'N-P', 'C-P', 'Optimized Plot');
    shading interp
    hold on
    k=k+1;
end
figure
ternpcolor(D, E, F, opt);
shading interp;
hold on;
ternplot(D, E, F, '*');
shading interp;
hold off;
h = axes('Position', [0.179 0.11 0.8 0.785], 'Layer','bottom'); 
terncontour(D, E, F, opt); 
shading interp;
ternlabel('I-P', 'N-P', 'C-P', 'Optimized Plot');
axis(h, 'off', 'equal', 'tight');
colorbar;

figure
[d e]=size(opt);
out=reshape(opt,(d*e),1);
terncontour([D,D,D], [E,E,E], [F,F,F], out'); ternlabel('I-P', 'N-P', 'C-P', 'Optimized Plot');
colorbar;

end
end


    

Contact us