%
%   subplot_real_image_one_loglin.m  ver 1.0  by Tom Irvine
%
function[fig_num]=subplot_real_image_one_loglin(fig_num,data1,t_string,fmin,fmax)


y1=max(abs(real(data1(:,2))));
y2=max(abs(imag(data1(:,2))));

yabs=max([y1 y2]);

[ymax,yTT,ytt,jflag]=ytick_linear_double_sided(yabs);

[xtt,xTT,iflag]=xtick_label(fmin,fmax);

figure(fig_num);

subplot(2,1,1);
plot(data1(:,1),real(data1(:,2)));
ylabel('Real');

set(gca,'MinorGridLineStyle',':','GridLineStyle',':','XScale','log',...
                     'YScale','lin','XminorTick','off','YminorTick','off');
%
set(gca,'XGrid','on','GridLineStyle','-');
set(gca,'YGrid','on','GridLineStyle','-'); 


if(iflag==1)
    set(gca,'xtick',xtt);
    set(gca,'XTickLabel',xTT);
    fmin=min(xtt);
    fmax=max(xtt);  
end
xlim([fmin fmax]);
title(t_string);

if(jflag==1)
    set(gca,'ytick',ytt);
    set(gca,'YTickLabel',yTT);
    y1=min(ytt);
    y2=max(ytt);
    ylim([y1 y2]);
else
    ylim([-ymax ymax]);
end 


if(iflag==1)
    set(gca,'xtick',xtt);
    set(gca,'XTickLabel',xTT);
    fmin=min(xtt);
    fmax=max(xtt);  
end
xlim([fmin fmax])
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
subplot(2,1,2);
plot(data1(:,1),imag(data1(:,2)));
ylabel('Imaginary');

set(gca,'MinorGridLineStyle',':','GridLineStyle',':','XScale','log',...
                     'YScale','lin','XminorTick','off','YminorTick','off');
%
set(gca,'XGrid','on','GridLineStyle','-');
set(gca,'YGrid','on','GridLineStyle','-');

xlim([fmin fmax]);
xlabel('Frequency (Hz)');

if(jflag==1)
    set(gca,'ytick',ytt);
    set(gca,'YTickLabel',yTT);
    y1=min(ytt);
    y2=max(ytt);
    ylim([y1 y2]);
else
    ylim([-ymax ymax]);
end 

if(iflag==1)
    set(gca,'xtick',xtt);
    set(gca,'XTickLabel',xTT);
    fmin=min(xtt);
    fmax=max(xtt);  
end
xlim([fmin fmax])