The brand-new PN400 Phase Noise Test System is available for purchase! →

jorgeSigHound

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Exploring a recording in zero span mode #238721
    jorgeSigHound
    Participant

    Thanks for the quick reply. I will work on your considerations. Thank you and congratulations to the Signal Hound Collective for their excellent work.
    Greetings Jorge

    in reply to: Exploring a recording in zero span mode #238713
    jorgeSigHound
    Participant

    Hello
    I am trying to represent with MATLAB, from the processing of the IQ values in a *.iq file recorded with SPIKE, the values of ‘IQ vs. Time ‘, ‘ AM vs Time ‘, ‘ PM vs Time ‘ and ‘ FM vs Time ‘. In the process I have had the following difficulties:
    1. The values of the IQ data read from the recorded file of an X signal, differ from the values of the same signal but acquired directly using the bbgetiq () function.
    2. The values of the parameters’ IQ vs. Time ‘, ‘ AM vs Time ‘, ‘ PM vs Time ‘ and ‘ FM vs Time ‘. calculated and represented with MATLAB, differ from the values represented by the SPIKE software in the reproduction of the same .iq file.
    I am attaching the code in order to find out which error I am making.
    Thanks for the help

    
    % SCRIPT IQ signal representation recorded with SPIKE software. 
     
    clear variables;
    % clear functions;
    %% ADD TEMPORARY FOLDERS 
    addpath('SxIQ_REC');% Folder where the * .iq and * .xml files are located
     
    %% PARAMETERS
    fDir='IQREC-Test1';
    %IQ file of recordings with Signal Hound BB60A 
    fDir_iq=[fDir '.iq'];
    fDir_xml=[fDir '.xml'];
     
    %% Reading XML file. 
    iqXMLDoc= xmlread(fDir_xml);
        %<CenterFrequency>
            CenterFrequency_List = (iqXMLDoc.getElementsByTagName('CenterFrequency'));
            CeFr = str2double(CenterFrequency_List.item(0).getFirstChild.getData);
        %<SampleRate>
            SampleRate_List = (iqXMLDoc.getElementsByTagName('SampleRate'));
            SaRa = str2double(SampleRate_List.item(0).getFirstChild.getData);
        %<Decimation>
            Decimation_List = (iqXMLDoc.getElementsByTagName('Decimation'));
            Dec = str2double(Decimation_List.item(0).getFirstChild.getData);
        %<ScaleFactor>
            ScaleFactor_List = (iqXMLDoc.getElementsByTagName('ScaleFactor'));
            ScFa= str2double(ScaleFactor_List.item(0).getFirstChild.getData); 
    %% Reading and processing of the .iq file 
    f=fopen(fDir_iq,'r'); 
        s=fread(f,'int16'); 
        n=length(s)/2;
        iq = reshape(s, 2, n);% Transform s into a two-row, n-column matrix. 
        vSh = iq(1,:) + 1i * iq(2,:);% Form the complex signal . 
       
        %2) Convert 16-bit integer max scaled values to floating point values between -1 and 1. 
        ScBin=2^16/2;
        vSh=vSh/ScBin;
     
       % 3) Multiply by the scale factor that the XML file has 
        vSh=vSh*ScFa;
        vI = real(vSh);
        vQ = imag(vSh);
            
    %     % Calculate the power of the samples in dBm 
    %     vS_dBm=10*log10(vI.^2+vQ.^2);
    %% GRAPHICS 
    iqdata = vSh;% Vector containing the complex values of the IQ signal 
    iqlen=length(iqdata);% 
    iqdata = transpose(iqdata);% perform the transpose 
    Ts=1/SaRa;
     
        subplot(2,2,1);
            am = 10.0 * log10(abs(iqdata).^2);
            
            plot(am);
            title('AM vs Time');
            xlabel('Sample number');
            ylabel('Amplitude (dBm)');
                  
        %
        subplot(2,2,3);
            x = linspace(1, iqlen, iqlen);
            plot(x, real(iqdata), x, imag(iqdata));
            title('IQ vs. Time');
            xlabel('Sample number');
            ylabel('Amplitude ()');
        
        subplot(2,2,2);
            pm=atan2(imag(iqdata),real(iqdata));
            dg_pm= diff ([0;pm]);% [0;pm] so that dg_pm has the same values as pm 
            fm=dg_pm*(SaRa/(2*pi));
          
            plot(fm/1e6);
            title('FM vs Time');
            xlabel('Sample number');
            ylabel('Frequency (MHz)');
            axis([0,length(x),-inf,inf]);
    
        
        subplot(2,2,4);
            plot(pm);
            title('PM vs Time');
            xlabel('Sample number');
            ylabel('Phase');
            axis([0,length(x),-inf,inf]);
    
    %%
     rmpath('SxIQ_REC');% Delete the folder in the MATLAB paths 
    
    Attachments:
    You must be logged in to view attached files.
Viewing 2 posts - 1 through 2 (of 2 total)