clear all;
close('all','hidden');

%nr_pts_x=input('Number of points in x direction: ');
%nr_pts_y=input('Number of points in y direction: ');
intvstart_x=-3;
intvend_x=3;
intvstart_y=-3;
intvend_y=3;
nr_pts_x=256;
nr_pts_y=256;

t_x = linspace(intvstart_x,intvend_x,nr_pts_x);
t_y = linspace(intvstart_y,intvend_y,nr_pts_y);
[X,Y]=meshgrid(intvstart_x:(intvend_x-intvstart_x)/(nr_pts_x-1):intvend_x, intvstart_y:(intvend_y-intvstart_y)/(nr_pts_y-1):intvend_y);
for i=1:nr_pts_x;
    for j=1:nr_pts_y;
%        t(i,j)=intvstart_x+i*(intvend-intvstart)/nrpts_x;
%        s(i,j)=t_x(i)*t_y(j)*sin(20*t_x(i)*t_y(j))+t_x(i)*t_y(j)*sin(500*t_x(i)*t_y(j))+0.5*((1-t_x(i)^2)*(1-t_y(j)^2))*cos(1000*t_x(i)*t_y(j));
s(i,j)=(t_x(i)*t_x(i)+t_y(j)*t_y(j))*sin(5*t_x(i)*t_y(j))+10*sin(50*t_x(i)*t_y(j));
%s(i,j)=t_x(i)*t_x(i)*t_x(i)*t_x(i);
%s(i,j)=(t_x(i)*t_x(i))+(t_y(j)*t_y(j));
    end
end

s1=s';

max_0=max(max(s1));
min_0=min(min(s1));
max_c0=max(min_0,max_0);

figure(1);
CLIM2 = [-max_c0 max_c0];
RECT = [0.1, 0.1, 0.85, 0.85];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
plot(t_x,(intvend_y-intvstart_y)/(intvend_x-intvstart_x)*t_x+...
    intvstart_y-(intvend_y-intvstart_y)/(intvend_x-intvstart_x)*intvstart_x);
g1=get(gca,'XTickLabel');
g2=get(gca,'XTick');
h1=get(gca,'YTickLabel');
h2=get(gca,'YTick');
len1=length(g2);
len2=length(h2);
for i=1:len1
    g3(i)=(g2(i)-intvstart_x)/(intvend_x-intvstart_x)*nr_pts_x;
end
for i=1:len2
    h3(i)=(h2(i)-intvstart_y)/(intvend_y-intvstart_y)*nr_pts_y;
    for j=1:length(h1(i,:))
        h4(len2+1-i,j)=h1(i,j);
    end
end
%I1=image(image1);
I1=imagesc(s1,CLIM2);
%set(gca,'XTickLabel','-2|-1|0|1|2');
%sta='-3|-2|-1|0|1|2|3|4';
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);
%set(I1,'XData',[0 400]);
colorbar('vert','peer',BX);

len_image1_1=length(s1(1,:));
len_image1_2=length(s1(:,1));

[c1A1,c1H1,c1V1,c1D1] = dwt2(s1,'haar');

%[c1A2,c1H2,c1V2,c1D2] = dwt2(b21,'haar');
%[c1A3,c1H3,c1V3,c1D3] = dwt2(b31,'haar');
c1A1=c1A1/2;
c1H1=-c1H1;
c1V1=-c1V1;
A1=upcoef2('a',c1A1,'haar',1);
H1=upcoef2('h',c1H1,'haar',1);
len_ab1_1=length(c1A1(1,:));
len_ab1_2=length(c1A1(:,1));


max_0=max(max(c1A1));
min_0=min(min(c1A1));
max_c0=max(min_0,max_0);
max_1=max(max(c1V1));
max_2=max(max(c1H1));
max_3=max(max(c1D1));
max_c1=max(max(max_1,max_2),max_3);
min_1=min(min(c1V1));
min_2=min(min(c1H1));
min_3=min(min(c1D1));
min_c1=min(min(min_1,min_2),min_3);
maxmax_c1=max(min_c1,max_c1);

figure(2);
%CLIM = [min_c1 max_c1];
CLIM = [-maxmax_c1 maxmax_c1];
CLIM1 = [min_3 max_3];
CLIM2 = [-max_c0 max_c0];
if (abs(min_3-max_3)<0.001)
    ['yes'];
    min_3=min_3*0.99;
    max_3=max_3*1.01;
    CLIM1 = [min_3 max_3];
end
RECT = [0.1, 0.55, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
plot(t_x,(intvend_y-intvstart_y)/(intvend_x-intvstart_x)*t_x+...
    intvstart_y-(intvend_y-intvstart_y)/(intvend_x-intvstart_x)*intvstart_x);
g1=get(gca,'XTickLabel');
g2=get(gca,'XTick');
h1=get(gca,'YTickLabel');
h2=get(gca,'YTick');
len1=length(g2);
len2=length(h2);
for i=1:len1
    g3(i)=(g2(i)-intvstart_x)/(intvend_x-intvstart_x)*nr_pts_x/2;
end
for i=1:len2
    h3(i)=(h2(i)-intvstart_y)/(intvend_y-intvstart_y)*nr_pts_y/2;
    for j=1:length(h1(i,:))
        h4(len2+1-i,j)=h1(i,j);
    end
end
%I2=image(image2);
I2=imagesc(c1A1,CLIM2);
%set(gca,'XTickLabel','-2|-1|0|1|2');
%sta='-3|-2|-1|0|1|2|3|4';
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);
colorbar('vert','peer',BX);

%set(I1,'XData',[0 400]);
RECT = [0.55, 0.55, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
I2v=imagesc(c1V1,CLIM);%,[min_c1V1 max_c1V1]);
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);

colorbar('vert','peer',BX);
RECT = [0.1, 0.1, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
I2h=imagesc(c1H1,CLIM);
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);
colorbar('vert','peer',BX);

RECT = [0.55, 0.1, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
I2d=imagesc(c1D1,CLIM1);
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);

colorbar('vert','peer',BX);

[c2A1,c2H1,c2V1,c2D1] = dwt2(c1A1,'haar');
%[c1A2,c1H2,c1V2,c1D2] = dwt2(b21,'haar');
%[c1A3,c1H3,c1V3,c1D3] = dwt2(b31,'haar');
c2A1=c2A1/2;
len_ab2_1=length(c2A1(1,:));
len_ab2_2=length(c2A1(:,1));

max_0=max(max(c2A1));
min_0=min(min(c2A1));
max_c0=max(min_0,max_0);
max_1=max(max(c2V1));
max_2=max(max(c2H1));
max_3=max(max(c2D1));
max_c1=max(max(max_1,max_2),max_3);
min_1=min(min(c2V1));
min_2=min(min(c2H1));
min_3=min(min(c2D1));
min_c1=min(min(min_1,min_2),min_3);
maxmax_c1=max(min_c1,max_c1);

figure(3);
%CLIM = [min_c1 max_c1];
CLIM = [-maxmax_c1 maxmax_c1];
CLIM1 = [min_3 max_3];
CLIM2 = [-max_c0 max_c0];
if (abs(min_3-max_3)<0.001)
    ['yes'];
    min_3=min_3*0.99;
    max_3=max_3*1.01;
    CLIM1 = [min_3 max_3];
end
RECT = [0.1, 0.55, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
plot(t_x,(intvend_y-intvstart_y)/(intvend_x-intvstart_x)*t_x+...
    intvstart_y-(intvend_y-intvstart_y)/(intvend_x-intvstart_x)*intvstart_x);
g1=get(gca,'XTickLabel');
g2=get(gca,'XTick');
h1=get(gca,'YTickLabel');
h2=get(gca,'YTick');
len1=length(g2);
len2=length(h2);
for i=1:len1
    g3(i)=(g2(i)-intvstart_x)/(intvend_x-intvstart_x)*nr_pts_x/4;
end
for i=1:len2
    h3(i)=(h2(i)-intvstart_y)/(intvend_y-intvstart_y)*nr_pts_y/4;
    for j=1:length(h1(i,:))
        h4(len2+1-i,j)=h1(i,j);
    end
end
%I2=image(image2);
imagesc(c2A1,CLIM2);
%set(gca,'XTickLabel','-2|-1|0|1|2');
%sta='-3|-2|-1|0|1|2|3|4';
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);
colorbar('vert','peer',BX);

%set(I1,'XData',[0 400]);
RECT = [0.55, 0.55, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
imagesc(c2V1,CLIM);%,[min_c1V1 max_c1V1]);
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);

colorbar('vert','peer',BX);
RECT = [0.1, 0.1, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
imagesc(c2H1,CLIM);
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);
colorbar('vert','peer',BX);

RECT = [0.55, 0.1, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
imagesc(c2D1,CLIM1);
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);

colorbar('vert','peer',BX);


[c3A1,c3H1,c3V1,c3D1] = dwt2(c2A1,'haar');
%[c1A2,c1H2,c1V2,c1D2] = dwt2(b21,'haar');
%[c1A3,c1H3,c1V3,c1D3] = dwt2(b31,'haar');
c3A1=c3A1/2;
len_ab3_1=length(c3A1(1,:));
len_ab3_2=length(c3A1(:,1));

max_0=max(max(c3A1));
min_0=min(min(c3A1));
max_c0=max(min_0,max_0);
max_1=max(max(c3V1));
max_2=max(max(c3H1));
max_3=max(max(c3D1));
max_c1=max(max(max_1,max_2),max_3);
min_1=min(min(c3V1));
min_2=min(min(c3H1));
min_3=min(min(c3D1));
min_c1=min(min(min_1,min_2),min_3);
maxmax_c1=max(min_c1,max_c1);



figure(4);
%CLIM = [min_c1 max_c1];
CLIM = [-maxmax_c1 maxmax_c1];
CLIM1 = [min_3 max_3];
CLIM2 = [-max_c0 max_c0];
if (abs(min_3-max_3)<0.001)
    ['yes'];
    min_3=min_3*0.99;
    max_3=max_3*1.01;
    CLIM1 = [min_3 max_3];
end
RECT = [0.1, 0.55, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
plot(t_x,(intvend_y-intvstart_y)/(intvend_x-intvstart_x)*t_x+...
    intvstart_y-(intvend_y-intvstart_y)/(intvend_x-intvstart_x)*intvstart_x);
g1=get(gca,'XTickLabel');
g2=get(gca,'XTick');
h1=get(gca,'YTickLabel');
h2=get(gca,'YTick');
len1=length(g2);
len2=length(h2);
for i=1:len1
    g3(i)=(g2(i)-intvstart_x)/(intvend_x-intvstart_x)*nr_pts_x/8;
end
for i=1:len2
    h3(i)=(h2(i)-intvstart_y)/(intvend_y-intvstart_y)*nr_pts_y/8;
    for j=1:length(h1(i,:))
        h4(len2+1-i,j)=h1(i,j);
    end
end
%I2=image(image2);
imagesc(c3A1,CLIM2);
%set(gca,'XTickLabel','-2|-1|0|1|2');
%sta='-3|-2|-1|0|1|2|3|4';
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);
colorbar('vert','peer',BX);

%set(I1,'XData',[0 400]);
RECT = [0.55, 0.55, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
imagesc(c3V1,CLIM);%,[min_c1V1 max_c1V1]);
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);

colorbar('vert','peer',BX);
RECT = [0.1, 0.1, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
imagesc(c3H1,CLIM);
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);
colorbar('vert','peer',BX);

RECT = [0.55, 0.1, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
imagesc(c3D1,CLIM1);
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);

colorbar('vert','peer',BX);


[c4A1,c4H1,c4V1,c4D1] = dwt2(c3A1,'haar');
%[c1A2,c1H2,c1V2,c1D2] = dwt2(b21,'haar');
%[c1A3,c1H3,c1V3,c1D3] = dwt2(b31,'haar');
c4A1=c4A1/2;
len_ab4_1=length(c4A1(1,:));
len_ab4_2=length(c4A1(:,1));

max_0=max(max(c4A1));
min_0=min(min(c4A1));
max_c0=max(min_0,max_0);
max_1=max(max(c4V1));
max_2=max(max(c4H1));
max_3=max(max(c4D1));
max_c1=max(max(max_1,max_2),max_3);
min_1=min(min(c4V1));
min_2=min(min(c4H1));
min_3=min(min(c4D1));
min_c1=min(min(min_1,min_2),min_3);
maxmax_c1=max(min_c1,max_c1);

figure(5);
%CLIM = [min_c1 max_c1];
CLIM = [-maxmax_c1 maxmax_c1];
CLIM1 = [min_3 max_3];
CLIM2 = [-max_c0 max_c0];
if (abs(min_3-max_3)<0.001)
    ['yes'];
    min_3=min_3*0.99;
    max_3=max_3*1.01;
    CLIM1 = [min_3 max_3];
end
RECT = [0.1, 0.55, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
plot(t_x,(intvend_y-intvstart_y)/(intvend_x-intvstart_x)*t_x+...
    intvstart_y-(intvend_y-intvstart_y)/(intvend_x-intvstart_x)*intvstart_x);
g1=get(gca,'XTickLabel');
g2=get(gca,'XTick');
h1=get(gca,'YTickLabel');
h2=get(gca,'YTick');
len1=length(g2);
len2=length(h2);
for i=1:len1
    g3(i)=(g2(i)-intvstart_x)/(intvend_x-intvstart_x)*nr_pts_x/16;
end
for i=1:len2
    h3(i)=(h2(i)-intvstart_y)/(intvend_y-intvstart_y)*nr_pts_y/16;
    for j=1:length(h1(i,:))
        h4(len2+1-i,j)=h1(i,j);
    end
end
%I2=image(image2);
imagesc(c4A1,CLIM2);
%set(gca,'XTickLabel','-2|-1|0|1|2');
%sta='-3|-2|-1|0|1|2|3|4';
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);
colorbar('vert','peer',BX);

%set(I1,'XData',[0 400]);
RECT = [0.55, 0.55, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
imagesc(c4V1,CLIM);%,[min_c1V1 max_c1V1]);
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);

colorbar('vert','peer',BX);
RECT = [0.1, 0.1, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
imagesc(c4H1,CLIM);
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);
colorbar('vert','peer',BX);

RECT = [0.55, 0.1, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
imagesc(c4D1,CLIM1);
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);

colorbar('vert','peer',BX);


[c5A1,c5H1,c5V1,c5D1] = dwt2(c4A1,'haar');
%[c1A2,c1H2,c1V2,c1D2] = dwt2(b21,'haar');
%[c1A3,c1H3,c1V3,c1D3] = dwt2(b31,'haar');
c5A1=c5A1/2;
len_ab5_1=length(c5A1(1,:));
len_ab5_2=length(c5A1(:,1));

max_0=max(max(c5A1));
min_0=min(min(c5A1));
max_c0=max(min_0,max_0);
max_1=max(max(c5V1));
max_2=max(max(c5H1));
max_3=max(max(c5D1));
max_c1=max(max(max_1,max_2),max_3);
min_1=min(min(c5V1));
min_2=min(min(c5H1));
min_3=min(min(c5D1));
min_c1=min(min(min_1,min_2),min_3);
maxmax_c1=max(min_c1,max_c1);

figure(6);
%CLIM = [min_c1 max_c1];
CLIM = [-maxmax_c1 maxmax_c1];
CLIM1 = [min_3 max_3];
CLIM2 = [-max_c0 max_c0];
if (abs(min_3-max_3)<0.001)
    ['yes'];
    min_3=min_3*0.99;
    max_3=max_3*1.01;
    CLIM1 = [min_3 max_3];
end
RECT = [0.1, 0.55, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
plot(t_x,(intvend_y-intvstart_y)/(intvend_x-intvstart_x)*t_x+...
    intvstart_y-(intvend_y-intvstart_y)/(intvend_x-intvstart_x)*intvstart_x);
g1=get(gca,'XTickLabel');
g2=get(gca,'XTick');
h1=get(gca,'YTickLabel');
h2=get(gca,'YTick');
len1=length(g2);
len2=length(h2);
for i=1:len1
    g3(i)=(g2(i)-intvstart_x)/(intvend_x-intvstart_x)*nr_pts_x/32;
end
for i=1:len2
    h3(i)=(h2(i)-intvstart_y)/(intvend_y-intvstart_y)*nr_pts_y/32;
    for j=1:length(h1(i,:))
        h4(len2+1-i,j)=h1(i,j);
    end
end
%I2=image(image2);
imagesc(c5A1,CLIM2);
%set(gca,'XTickLabel','-2|-1|0|1|2');
%sta='-3|-2|-1|0|1|2|3|4';
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);
colorbar('vert','peer',BX);

%set(I1,'XData',[0 400]);
RECT = [0.55, 0.55, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
imagesc(c5V1,CLIM);%,[min_c1V1 max_c1V1]);
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);

colorbar('vert','peer',BX);
RECT = [0.1, 0.1, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
imagesc(c5H1,CLIM);
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);
colorbar('vert','peer',BX);

RECT = [0.55, 0.1, 0.35, 0.35];
BX=axes('Position',RECT);
set(BX,'XLim',[intvstart_x intvend_x]);
set(BX,'YLim',[intvstart_y intvend_y]);
set(gcf,'CurrentAxes',BX);
imagesc(c5D1,CLIM1);
set(gca,'XTick',g3);
set(gca,'XTickLabel',g1);
set(gca,'YDir','rev');
set(gca,'YTick',h3);
set(gca,'YTickLabel',h4);

colorbar('vert','peer',BX);
