File:Normalized frequency example.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 845 × 675 pixels, file size: 29 KB)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    English: This is an example of plotting samples of a frequency distribution in the unit "bins", which are integer values. A scale factor of 0.7812 converts a bin number into the corresponding physical unit (hertz).
    Date
    Source Own work
    Author Bob K
    Permission
    (Reusing this file)
    I, the copyright holder of this work, hereby publish it under the following license:
    Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
    The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

    SVG development
    InfoField
     The source code of this SVG is invalid due to an error.
    V
     This W3C-invalid vector image was created with GNU Octave by Bob K.

    Source code

    The logo of GNU Octave – numerical computation software
    The logo of GNU Octave – numerical computation software
    This media was created with GNU Octave (numerical computation software)
    Here is a listing of the source used to create this file.

    Deutsch ∙ македонски ∙ English ∙ +/−

    graphics_toolkit("qt")
    d = 4;                                    % amount to add to text sizes
    set(0, "DefaultFigureColor",.94*[1 1 1])  % This coloring between subplots does not show up in the .svg output.
    set(0, "DefaultAxesFontsize",12+d)        % size of numeric tick labels
    set(0, "DefaultTextFontsize",12+d)
    
    T = 0.01;			          % seconds per sample
    sam_per_sec = 1/T;
    N = 128;			          % number of frequency samples
    N2 = N/2;
    Hz_per_bin = sam_per_sec/N  % no semi-colon, so value is displayed in Octave command window
    L = 11;				      % pulse_width (samples)
    L2 = (L-1)/2;
    
    s = [ones(1,L) zeros(1,N-L)];  % Zero-fill the signal so a DFT produces N frequency samples.
    S = fft(circshift(s,-L2));     % Rotate s() to take advantage of symmetry.  S() is therefore real-valued.
    
    hfig = figure("position",[1 1 1000 800]);
    subplot(2,1,1)
    plot((-N2:N2-1)*T, circshift(s,N2-L2), "linewidth",3)   % Center the pulse at 0 seconds.
    xlim([-N2 N2-1]*T)
    ylim([0 2])
    title("Signal", "fontsize",14+d)
    xlabel("Actual time (seconds)", "fontsize",12+d)
    
    subplot(2,1,2)
    plot(0:N2-1, S(1:N2))                                         % Plot the discrete-time Fourier transform.
    hold on
    plot(0:N2-1, S(1:N2), ".", "markersize",12, "color","blue")   % Overlay the DTFT samples.
    xlim([0 N2-1])
    set(gca, "xaxislocation","origin")
    set(gca, "xtick",0:10:N2-1)	                         %, "fontsize",12) ~ optional code
    title("Fourier transform samples", "fontsize",14+d)
    xlabel("Normalized frequency (0.7812 Hz/bin)")
    

    Captions

    Example of using a normalized frequency scale to plot spectral data

    Items portrayed in this file

    depicts

    5 February 2023

    image/svg+xml

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current20:29, 5 February 2023Thumbnail for version as of 20:29, 5 February 2023845 × 675 (29 KB)wikimediacommons>Bob KUploaded own work with UploadWizard

    There are no pages that use this file.