function plotSINC(P,type)
% plot complex frequency response of 
% H_2pi_hz=P*exp(-j*pi*hz*P).*sinc(hz*P)
% for 10 periods of hz centered around the zero frequency.
% P is the intergration constant and 
% type is either:
%    't'                      cycles per second
%    'x'    x=1/lambda_0,     cycles per meter
%    'phi'  phi=X/lambda_0,   wavelength response
%
figure

% set labels and plotting limits
if type=='t'
    label_x=['{\it{f}} [Hz]'];
    label_title=['Complex Freqency Response of H(\it{j2{\pi} f})'];
    hz_limit=5/P;
    hz_step=.01/P;
    hz=-hz_limit:hz_step:hz_limit;    % create vector of cycles per unit (Hz)
else 
    if type == 'x'
        label_x=['1/{\it{\lambda}} [Hz]'];
        label_title=['Complex Freqency Response of H(\it{j2{\pi} / \lambda})'];
        hz_limit=5/P;
        hz_step=.01/P;
        hz=-hz_limit:hz_step:hz_limit;    % create vector of cycles per unit (Hz)    
    else 
        if type=='phi'
            label_x=['{\it{cos(\phi )}}'];
            label_title=['Complex Freqency Response of H(\it{j2{\pi} cos(\phi ) / \lambda_0})'];
            hz_limit=1;
            hz_step=.001;
            hz=-hz_limit:hz_step:hz_limit;    % create cos_phi vector from -1 to +1
        else
            error('Type must be either ''t'', ''x'', or ''phi''')
        end
    end
end

% Position Label
if type ~= 'phi'
    temp=1/P;
    point_label_x=temp-.55*temp;       
    point_label_y=-.03*P;
    point_label=num2str(temp);
else
    temp=1/P;
    point_label_x=temp-.1;       
    point_label_y=-.03*P;
    point_label=num2str(temp);
end

% Make Labels consist to six digits
temp2=length(point_label);
if temp2 < 6
    if round(temp)==temp             
        point_label=[point_label '.'];
        for i=temp2+2:6
            point_label=[point_label '0'];
        end
    else 
        for i=temp2+1:6
            point_label=[point_label '0'];
        end
    end
else
    if temp < 1000000
        point_label=point_label(1:6);
    end
end

% Complex Frequency Response
H_2pi_hz=P*exp(-j*pi*hz*P).*sinc(hz*P);
                                  
% Calculate Magnitude of H(j*2*pi*f))                              
mag_H=abs(H_2pi_hz);


% plot results
title(label_title)
hold on
axis square
axis([-hz_limit hz_limit -.1*P P])
plot(hz,mag_H)
plot([-hz_limit hz_limit],[0 0],'k')
xlabel(label_x), ylabel('Magnitude')
text(point_label_x,point_label_y,point_label)