%
%  acoustic_plate_plots_alt.m ver 1.1  by Tom Irvine
%
function[fig_num]=acoustic_plate_plots_alt(fig_num,x,y,iu,f,HM,HM_stress_xx,HM_stress_yy,HM_stress_xy,HM_stress_vM)
%


fmin=f(1);
fmax=f(end);

phase_xx=angle(HM_stress_xx)*180/pi;
phase_yy=angle(HM_stress_yy)*180/pi;
phase_xy=angle(HM_stress_xy)*180/pi;
phase_H=angle(HM)*180/pi;

HM=abs(HM);
HM_stress_xx=abs(HM_stress_xx);
HM_stress_yy=abs(HM_stress_yy);
HM_stress_xy=abs(HM_stress_xy);
HM_stress_vM=abs(HM_stress_vM);


f=fix_size(f);
HM=fix_size(HM);
HM_stress_vM=fix_size(HM_stress_vM);
HM_stress_xx=fix_size(HM_stress_xx);
HM_stress_yy=fix_size(HM_stress_yy);
HM_stress_xy=fix_size(HM_stress_xy);

x_label='Frequency (Hz)';

%%%%%%

if(iu==1)
    t_string=sprintf('Displacement Frequency Response Function at x=%g y=%g inch ',x,y);
    ylab='[Displacement/Pressure] (in/psi)';
else
    t_string=sprintf('Displacement Frequency Response Function at x=%g y=%g meters ',x,y);
    ylab='[Displacement/Pressure] (m/Pa)';    
end

md=6;

ff=f;
FRF_p=phase_H;
FRF_m=HM;

[fig_num]=...
    plot_magnitude_phase_function(fig_num,t_string,fmin,fmax,ff,FRF_p,FRF_m,ylab,md);
%
%%%

ppp1=[f HM_stress_xx];
ppp2=[f HM_stress_yy];
leg1='Hxx';
leg2='Hyy';

    if(iu==1)
        t_string=sprintf('Stress Frequency Response Function at x=%g y=%g inch ',x,y);        
        y_label='[Stress/Pressure] (psi/psi)';
    else
        t_string=sprintf('Stress Frequency Response Function at x=%g y=%g meters ',x,y);        
        y_label='[Stress/Pressure] (Pa/Pa)';        
    end
  

[fig_num,h2]=plot_loglog_function_md_two_h2(fig_num,x_label,...
               y_label,t_string,ppp1,ppp2,leg1,leg2,fmin,fmax,md);

%%%

ff1=f;
ff2=f;

FRF_p1=phase_xx;
FRF_m1=HM_stress_xx;
FRF_p2=phase_yy;
FRF_m2=HM_stress_yy;

t_string1=sprintf('Hxx %s',t_string);
t_string2=sprintf('Hyy %s',t_string);

ylab=y_label;

[fig_num]=...
    subplot_magnitude_phase_two_function(fig_num,t_string1,t_string2,...
                    fmin,fmax,ff1,FRF_p1,FRF_m1,ff2,FRF_p2,FRF_m2,ylab,md);

%%%
    
    ppp=[f HM_stress_xy];
    if(iu==1)
        t_string=sprintf('Hxy Frequency Response Function at x=%g y=%g inch',x,y);        
        y_label='[Stress/Pressure] (psi/psi)';
    else
        t_string=sprintf('Hxy Frequency Response Function at x=%g y=%g meters',x,y);           
        y_label='[Stress/Pressure] (Pa/Pa)';        
    end    
    
    [fig_num]=plot_loglog_function_md(fig_num,x_label,y_label,t_string,ppp,fmin,fmax,md);
    
%%%

    ppp=[f HM_stress_vM];
    if(iu==1)
        t_string=sprintf('von Mises Stress Frequency Response Function at x=%g y=%g inch',x,y);        
        y_label='[Stress/Pressure] (psi/psi)';
    else
        t_string=sprintf('von Mises Stress Frequency Response Function at x=%g y=%g meters',x,y);           
        y_label='[Stress/Pressure] (Pa/Pa)';        
    end    
    
    [fig_num]=plot_loglog_function_md(fig_num,x_label,y_label,t_string,ppp,fmin,fmax,md);

%%%