image thumbnail
from Spur Chart Plotter by Tim Merkin
This m-file plots a spur chart for the mixing operation in a receiver

SpuriousResponseChart.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Program: SpuriousResponseChart.m
%Authors: Tim Merkin and Chris Stimek
%Date Written: 7/21/2005
%Description:  This m-file calculates and plots all spurious responses
%              for mixing inter-modulation products.  Be sure to set
%              the control variable below specifically for your system.
%              Also, You must specify the plot axis for x and y, in order
%              for the window to plot the desired area of the spurious
%              response chart.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Prepare Screen and figures for plotting
clc;  
close all;

%%%%%%%%%%%%%%%%%%Control Variables%%%%%%%%%%%%%%%%%%%%

order=5;   %Number of Inter-modulation products to calculate

LO = 's'; %Set LO = 'h' for High side LO difference Mixing
           %Set LO = 'l' for Low side LO difference Mixing
           %Set LO = 's' for sum mixing
           
Ft_high=1; %High side tuning range (Frequency) for calculation purposes
Ft_low=0;  %Low side tuning range (Frequency) for calculation purposes
Fif=1;     %Intermediate Frequency; Set equal to unity for
           %a normalized spur chart plot

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

T=Ft_low/Fif:0.0001:Ft_high/Fif;  %T is Normalized Tuning Frequency
                                  %Which is used in the equations for
                                  %calculating the spur chart

figure(1)
hold on;
grid on;

%Calculate Spurious Responses for Low Side LO difference Mixing
if LO == 'l'
    for n = 0:order
        for m = 1:order
            Fspurious=abs((-n+n*T-1)/m)*Fif;
            plot(T*Fif,Fspurious);
        end
    end
    for n = 0:1:order
        for m = 1:1:order
            Fspurious=abs((n-n*T-1)/m)*Fif;
            plot(T*Fif,Fspurious);
        end
    end
    title('Low Side LO Difference Mixing');
end

%%%%%%

%Calculate Spurious Responses for High Side LO difference Mixing
if LO == 'h'
    for n = 0:order
        for m = 1:order
            Fspurious=abs((n+n*T-1)/m)*Fif;
            plot(T*Fif,Fspurious);
        end
    end
    for n = 0:1:order
        for m = 1:1:order
            Fspurious=abs((-n-n*T-1)/m)*Fif;
            plot(T*Fif,Fspurious);
        end
    end
    title('High Side LO Difference Mixing');
end

%%%%%%

%Calculate Spurious Responses for High Side LO difference Mixing
if LO == 's'
    for n = 0:order
        for m = 1:order
            Fspurious=abs((n-n*T-1)/m)*Fif;
            plot(T*Fif,Fspurious);
        end
    end
    for n = 0:1:order
        for m = 1:1:order
            Fspurious=abs((-n+n*T-1)/m)*Fif;
            plot(T*Fif,Fspurious);
        end
    end
    title('Sum Mixing');
end

%%%%%%

%Label the plot and specify window range
AXIS([0 1 0 1.4]); %Format: Axis([Xmin Xmax Ymin Ymax]);
xlabel('Tuning Frequency');
ylabel('Interferance Frequency');

Contact us at files@mathworks.com