Jump to content

英文维基 | 中文维基 | 日文维基 | 草榴社区

File:Normalized frequency example.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file (SVG file, nominally 845 × 675 pixels, file size: 29 KB)

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.
Octave/qt source
InfoField
click to expand
  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
current19:29, 5 February 2023Thumbnail for version as of 19:29, 5 February 2023845 × 675 (29 KB)Bob KUploaded own work with UploadWizard

The following page uses this file:

Metadata