Friday 10 November 2017

Moving Average Spectrum


Respuesta de Frecuencia del Filtro Promedio Corriente La respuesta de frecuencia de un sistema LTI es la DTFT de la respuesta de impulso. La respuesta de impulso de un promedio móvil de L-muestra es. Dado que el filtro de media móvil es FIR, la respuesta de frecuencia se reduce a la suma finita We Puede utilizar la identidad muy útil para escribir la respuesta de frecuencia como donde hemos dejado ae menos jomega. N 0 y M L menos 1. Podemos estar interesados ​​en la magnitud de esta función para determinar qué frecuencias pasan a través del filtro sin atenuación y cuáles son atenuadas. A continuación se muestra un gráfico de la magnitud de esta función para L 4 (rojo), 8 (verde) y 16 (azul). El eje horizontal varía de cero a pi radianes por muestra. Observe que en los tres casos, la respuesta de frecuencia tiene una característica de paso bajo. Un componente constante (frecuencia cero) en la entrada pasa a través del filtro sin atenuación. Ciertas frecuencias más altas, como pi / 2, son completamente eliminadas por el filtro. Sin embargo, si la intención era diseñar un filtro de paso bajo, entonces no lo hemos hecho muy bien. Algunas de las frecuencias más altas se atenúan sólo por un factor de 1/10 (para la media móvil de 16 puntos) o 1/3 (para la media móvil de cuatro puntos). Podemos hacer mucho mejor que eso. La gráfica anterior se creó mediante el siguiente código Matlab: omega 0: pi / 400: pi H4 (1/4) (1-exp (-iomega4)) ./ (1-exp (-iomega)) H8 (1/8 (1-exp (-iomega8)) ./ (1-exp (-iomega)) trama (omega Espectros de diversas transformaciones del ruido blanco El análisis espectral es la descomposición de funciones en Sus componentes cíclicos. Se lleva a cabo utilizando la transformada de Fourier. La transformada de Fourier de la función y (t) se define como: F y (omega) int minusinfin infin exp (menos i omegat) y (t) dt La transformada de Fourier es generalmente una función compleja. El espectro de una función es simplemente el valor absoluto de su transformada de Fourier. El espectro del ruido blanco es constante en una banda de frecuencias amplia. Esto es en analogía con la luz blanca que contiene la luz de todos los colores sobre la banda de frecuencia de la luz visible. A veces el ruido blanco se toma para extenderse sobre una gama infinita pero esto sería imposible de realizar físicamente porque tal ruido tendría enegy infinito. Si la banda de frecuencia es demasiado estrecha se diría que el ruido es de un color particular. Por lo tanto, el ruido blanco se define de tal manera que su espectro es F (omega) c para omega min le omega le omega max 0 de lo contrario La suma acumulativa de ruido blanco La suma acumulativa se define como la integral de ruido blanco. Si u (t) es ruido blanco entonces y (t) int 0 tu (s) ds y, equivalentemente dy / dt u (t) Como estado anterior, el espectro es la magnitud de la transformada de Fourier de la variable y por tanto F y (Omega) F u (omega) / (iomega) F u (omega) / omega Se dice que la variable y es el ruido rosa. El ruido rosa sería cualquier variable cuyo espectro sea de la forma F (omega) c / omega para omega min le omega le omega max 0 de otra manera El espectro de la media móvil de una variable La forma general de una media móvil de una variable y ( T) es y (t) int 0 H h (s) y (ts) ds donde h (s) para 0 le s le H es una función de ponderación. El límite superior H podría ser finito o infinito. Tenga en cuenta que el promedio móvil de una variable se denotará con un subrayado de esa variable. La transformada de Fourier de y (t) es F y (omega) int minusinfin infin exp (minusiomegat) y (t) dt int minusinfin infin exp (minusiomegat) (int 0H h (s) y (ts)) dsdt La inversión de El orden de integración da F y (omega) int 0 H h (s) int minusinfin infin exp (minusiomegat) y (ts) dtds Si la variable de integración en int minusinfin infin exp (minusiomegat) y (ts) dt se cambia a Zt-s entonces tzs y dtdz así que la integral se convierte en int minusinfin infin exp (minusiomega (zs)) y (z) dz que se reduce a exp (minusiomegas) int minusinfin infin exp (minusiomegaz) y (z) dz y finalmente a exp ( (Omega) Este es un teorema estándar para transformadas de Fourier que dice F y (ts) exp (minusiomegas) F y F y (omega) int 0 H h (s) exp (minusiomegas) F y (omegads que reduce H (s) exp (minusiomegas) ds Si h (s) se extiende sobre el intervalo menosinfin, infin tal que h (s) 0 para slt0 y sgeH entonces el segundo La relación es entonces F y (omega) F y (omega) middotF h (omega) Para una media móvil simple h (s) 1 / H y (1 / H) int 0 H exp (minusiomegas) ds se reduce a (1 / H) exp (minusiomegas) / (minusiomega 0 H (1 / H) exp (minusiHomega) minus1 / (iomega) que al factorizar un término de exp (2) / 2) que es exp (minusiomegaH / 2) sin (omegaH / 2) exp (iomegaH / 2) menos exp (minusiomegaH / 2) / (omegaH / 2) ) Etiquetando la variable t del promedio móvil con el punto medio del intervalo H, se puede eliminar el término exp (minusiomegaH / 2) dejando F y (omega) F y (omega ) Sinc (frac12omegaH) Dado que el espectro es el valor absoluto de la transformada de Fourier, la función relevante es sinc (x) La función sinc crea picos en el espectro del promedio móvil que no estaban en los datos originales. Sampling and Intervalizing Samping en el análisis espectral generalmente significa tomar el valor de una variable a intervalos discretos. Un procedimiento relacionado es reemplazar los valores instantáneos dentro de un intervalo por los valores de la muestra, es decir, para t i minusfrac12Hletlet i frac12H reemplazar y (t) con y (t i). La transformada de Fourier de la función intervindada se relaciona con la transformada de Fourier de la función muestreada mediante la multiplicación por un factor de la forma int minusfrac12H frac12H exp (minusiomegat) dt que se reduce a sinc (frac12omegaH) Dado que el procedimiento de intervalización se aplica a la media móvil De la variable original, la transformada de Fourier para la función de media móvil intervenida z (t) viene dada por F z (omega) F y sincsup2 (frac12omegaH) La sincsup2 (x) tiene la siguiente forma: Para y siendo ruido rosa, F y Omega) c / omega, el espectro de la función promedio de intervalos sube a un pico y luego disminuye. Por lo tanto, los componentes de baja frecuencia dominan el promedio del intervalo aún más que lo hacen para la suma acumulada. Una media móvil de promedios anuales Cualquier manipulación o transformación de datos que son las sumas acumulativas de perturbación aleatoria puede introducir elementos de estructura estocástica que son peculiares y no intuitivos y potencialmente peligrosos para el análisis estadístico objetivo. Por ejemplo, supongamos que los promedios anuales se calculan para las variables que son las sumas acumuladas de perturbaciones aleatorias y luego se promedian los promedios anuales en un período de cinco años. En el diagrama siguiente, el gráfico superior muestra los pesos que se colocan sobre las tasas de cambios. El promedio anual pone un peso relativamente alto en los cambios que ocurren a principios del año y un bajo peso en los cambios que ocurren cerca del final del año. Cuando los valores se promedian en un período de cinco años, los cambios que ocurren cerca del comienzo del quinquenio reciben una tasa mucho más alta que los que ocurren cerca del final del período de cinco años. El promedio quinquenal se identificaría típicamente con el tercer año, mientras que se relaciona más estrechamente con los cambios ocurridos en el primer año. Esto confundiría el análisis de los desfases temporales entre las variables. Ilustraciones El siguiente es el promedio móvil de cuatro periodos de un promedio móvil de cuatro periodos de variable aleatoria uniformemente distribuido entre 0 y 1.0. Para ilustrar cómo este doble suavizado genera la aparición de ciclos, se representa un ciclo sinusoidal alrededor de un nivel de 0,5 en el mismo gráfico. Autocorrelación Una cantidad físicamente medible, tal como la temperatura de un objeto, puede ser la suma acumulativa de una variable estocástica. En el caso de la temperatura de un objeto, la variable estocástica es proporcional a la entrada neta de calor al objeto. Sin embargo, esta variable puede estar sujeta a autocorrelación, es decir, a una dependencia de su distribución sobre sus valores pasados. Por ejemplo, la temperatura T (t) de un cuerpo en el tiempo t puede ser dada por T (t) T (t-1) U (t) pero U (t) lambdaU (t-1) V (t) Las variables V (t) son variables aleatorias independientes. La variable U (t) está dada por la fórmula U (t) V (t) lambdaV (t-1) lambdasup2V (t-2) hellip o, en general, U (t) Sigma j0 t lambda j V (tj) Esta es una suma ponderada exponencialmente, un tipo de operación de suavizado. Dado que la temperatura es la suma acumulada de la U (t) s, otra operación de suavizado, la temperatura es una variable doblemente suavizada. Como en el caso de una media móvil de un promedio móvil, el suavizado doble generará la aparición de ciclos incluso cuando la variable original, el V (t) s, es un ruido blanco aleatorio. Cuando las temperaturas se someten a promediar el resultado podría triplicar el ruido blanco suavizado que estaría aún más sujeto a la generación de tendencias y ciclos espurios. Diferenciación y diferenciación de promedios móviles Sea z (t) una variable y F z (omega) sea su transformada de Fourier. Si z (t) es una media móvil de la suma acumulativa de ruido blanco, su transformada de Fourier es de la forma F z (omega) (c) Así, la derivada de un promedio móvil de la suma acumulada de ruido blanco tiene un espectro que indica ciclos, pero el espectro proviene del proceso de media móvil en lugar de los datos originales (es decir, . De manera más general, la transformada de Fourier de una media móvil ponderada de una variable v (t) basada en una función de ponderación h (s) es de la forma F z (omega) F s (omega) F h (omega) Es la suma acumulada de ruido blanco entonces F s (omega) c / omega sobre un cierto rango de omega. Así, la transformada de Fourier de y (t) que es la derivada de la media móvil ponderada es entonces F y (omega) omega (c / omega) F h (omega) cF h (omega) Así el espectro de la derivada de un movimiento Promedio de ruido blanco es sólo el espectro del proceso de promediación. Esto significa que cuando se encuentran ciclos en la revisión de versiones procesadas de promedios móviles, pueden ser sólo un artefacto de los procedimientos de promediado y procesamiento. La diferenciación de las medias móviles sería más común que la diferenciación. El resultado es similar. Sea y (t) z (t) minusz (t-H) / H. La transformada de Fourier de y (t) es entonces F y (omega) (1 / H) (1-e - omegaH) F z (omega) Dado que (1-e - omegaH) omegaH menos (omegaH) sup2 / 2 hellip F Así, una transformada de Fourier de la suma cumulativa de ruido blanco se multiplicará por un factor que es un múltiplo de omega y el efecto es anular el omega en el denominador (omega), (omega minusomegasup2H / 2 hellip) De la transformada de Fourier de la suma acumulada del ruido blanco que deja aproximadamente sólo la transformada de Fourier de los procedimientos de promediación, es decir, F y (omega) (omega minusomegasup2H / 2 hellip) (c / omega) F h (omega) (1 menos omegaH / 2 Hellip) cF h (omega) que para valores pequeños de omegaH se reduce a F y (omega) cF h (omega) PÁGINA PRINCIPAL de applet-magic HOME PAGE DE Thayer WatkinsEste gráfico muestra el espectro como una línea de trama. Un eje de este gráfico es el dominio de frecuencia (con un desplazamiento de pantalla opcional), el otro es la amplitud (lineal o logarítmica, dependiendo del tipo de salida FFT actual). Con salida FFT logarítmica, la escala de amplitud está en decibelios (aproximadamente 90 decibeles máximo). El punto 0-dB se puede ajustar desde el diálogo de configuración de la pantalla (o por comando). La relación entre la tensión de entrada en el convertidor A / D y el valor de salida FFT en decibelios (dB) se explica aquí (utilice el botón de retroceso de su navegador para volver.) El rango de amplitud visualizado se puede modificar en el diálogo de configuración. Como una superposición para el gráfico de espectro, se puede mostrar una curva de referencia, una curva de retención de pico (que muestra los picos más grandes de los anteriores segundos XX verde en la captura de pantalla anterior) y una curva de espectro promedio Parte seleccionable del espectrograma rojo en la captura de pantalla anterior). Los colores de la pantalla - también los bolígrafos utilizados para varias curvas - también se pueden modificar en el diálogo de configuración. Puede hacer clic con el botón derecho del ratón en el gráfico del espectro para abrir un menú emergente que le permite: activar y desactivar una retícula de amplitud y frecuencia para girar el espectro (junto con la cascada) en 90 °. Cambiar entre la ventana dividida y el gráfico de tamaño completo (sin cascada), seleccione entre el modo de gráfico normal y un gráfico de barras especial, donde cada barra está pintada del mismo color que la cascada (dependiente de la amplitud). Activar y desactivar el gráfico de retención de picos (en el submenú Opciones de gráfico de espectro) activar y desactivar el gráfico momentáneo (sin promedio) (en el mismo submenú) activar y desactivar el espectro promedio a largo plazo (detalles en el capítulo sobre el promedio ). Y algunos otros ajustes para el gráfico del espectro La velocidad de actualización de esta pantalla (así como la cascada) depende de la velocidad de desplazamiento de la cascada. La resolución de frecuencia depende de la frecuencia de muestreo. ejecución. Tamaño FFT. Y la función de ventana FFT. El rango de frecuencia mostrado puede ser modificado con el panel Time Axis o tirando de la escala de frecuencia (amarilla o naranja) con el ratón. Mantenga pulsado el botón izquierdo y mueva el ratón hacia la izquierda / derecha (o arriba / abajo) mientras el cursor del ratón está sobre el eje de frecuencia amarillo. Puede haber algunos marcadores programables visibles en la escala de frecuencia, algunos de ellos se pueden mover con el ratón, mientras que otros son sólo indicadores (por ejemplo: la frecuencia del LO (VFO) se puede atar a uno de estos marcadores). Los pequeños círculos verde y verde en el área de gráfico indican el cursor de lectura de datos en el modo de detección de pico, los cruces rojos y verdes pequeños son los cursores de lectura en el modo normal (no de detección de pico). Véase también: Promedio de FFT. Diferentes tipos de promedio espectral ayudan a reducir el ruido cuando se busca señales débiles pero coherentes. El promedio opera en una secuencia de FFT. Suavizado FFT. Reducción adicional del ruido visible cuando se buscan señales débiles e incoherentes. El suavizado funciona en compartimientos de frecuencia vecinos, y causa un cierto desdibujamiento a lo largo del eje de la frecuencia. Pantalla de Cascada (aka Spectrogram) Este mapa de bits en movimiento muestra la historia de los últimos espectros registrados. A medida que transcurre el tiempo, las muestras viejas se desplazarán fuera de la vista, pero se pueden desplazar de nuevo con el control deslizante de tiempo en el panel Tiempo (en la esquina superior izquierda de la ventana principal). (Espectrograma estéreo con barra de amplitud y escala de frecuencia de registro) La intensidad (amplitud) de una frecuencia particular afecta el color de un píxel en este mapa de bits. La relación entre amplitud y color puede ser controlada por un panel de control de contraste y brillo en el lado izquierdo de la ventana principal. Además, puede activar la función AGC visual para que el programa ajuste el valor de brillo automáticamente cuando cambia el nivel de ruido (en el rango de frecuencias mostrado). En su forma original (con el agua cayendo), la coordenada X de un píxel se deriva del eje de frecuencia, y la coordenada Y es el eje del tiempo (dependiendo de la velocidad de desplazamiento que se puede ajustar bajo los ajustes de la pantalla) . El rango de frecuencia visible se puede modificar tirando de la escala de frecuencia con el ratón (mantenga pulsado el botón izquierdo del ratón con el puntero del ratón sobre la escala de frecuencia). El rango de frecuencia y la resolución que se pueden visualizar dependen de los ajustes FFT (tamaño, decimación, frecuencia central) y de la frecuencia de muestreo de audio. Por ejemplo, una FFT con una resolución de 40 uHz requiere aproximadamente 1/40 uHz 2500 segundos, o aproximadamente 7 horas, para recolectar el número equivalente de muestras. Si la cascada se ejecuta en modo RDF (radiogoniometría), el color de la cascada muestra el ángulo de llegada, mientras que el brillo muestra la intensidad de la señal. Más sobre eso en este documento separado. Para observaciones a largo plazo de bandas estrechas, la pantalla del espectrograma puede dividirse opcionalmente en múltiples tiras. Que dependerá de la orientación de la escala de frecuencia: si se ejecuta verticalmente, las tiras de espectrograma pequeñas se apilarán verticalmente, con la tira más nueva en la parte superior y la más antigua en la parte inferior. La altura de la tira se configura en la configuración de la pantalla. El número de tiras sólo está limitado por el tamaño de la pantalla. Notas: La cascada multi-tira no será rediseñada completamente si se modifica el contraste o el brillo. Para aplicaciones muy especiales, se puede iniciar una nueva tira en cualquier momento (incluso si la línea anterior no ha alcanzado el máximo con), utilizando el comando water. newstrip. Esto se puede utilizar, por ejemplo, para sincronizar la visualización multi-tira a horas UTC completas (siga el enlace para ver un ejemplo). Para otras aplicaciones especiales, con el evento Acciones condicionales: newstrip. Puede dejar que SL haga lo que quiera siempre que la pantalla llegue al final de una tira y comience la siguiente. Por ejemplo, al iniciar una nueva tira en la pantalla de cascada, puede ejecutar un programa girar la antena a otra dirección, cambiar un receptor (controlable a distancia) a una nueva frecuencia para la siguiente tira de la cascada, etc. Bat Monitor utiliza esa función para sincronizar la frecuencia de VFO de un receptor remoto con las tiras de la pantalla de cascada. Al igual que en muchos otros componentes del programa, puede activar un menú emergente específico del contexto haciendo clic con el botón derecho en la pantalla. Algunas opciones para la cascada son: Rejilla de frecuencia de superposición de tiempo de cascada. Permite marcadores de tiempo como superposición de rejilla (sobre el espectrograma) y / o etiquetas de texto en varios formatos - lea más. Rotación de la pantalla en 90 grados (escala de frecuencia vertical u horizontal), etc. Si la ventana principal muestra una combinación del gráfico de espectro y la cascada, ambos están separados por la escala de frecuencia desplazable (que se aplica a ambos). Notas: Haga clic en la cascada con el botón izquierdo del ratón para mostrar el gráfico del espectro para esa línea del espectrograma durante unos dos segundos. Parecerá que el gráfico del espectro está congelado por un corto tiempo, pero esto se hace deliberadamente. Para congelar la pantalla de la cascada durante un tiempo ilimitado, utilice el menú Start / Stop (detenga Spectrum Analyzer 1, que es el de la ventana principal). Haga clic en la cascada con el botón izquierdo del ratón, y mantenga pulsado el botón mientras se mueve el ratón para marcar un área rectangular. Cuando suelte el botón, aparecerá un menú emergente especial. En ese popup, puede seleccionar funciones especiales como la función de repetición del espectro. Haga clic en la cascada con el botón derecho del ratón para abrir un menú emergente, que da acceso rápido a algunos parámetros importantes sin tener que abrir el panel de control de la pantalla. La paleta de colores de la cascada se puede seleccionar haciendo clic en ella. También puede definir su propia paleta de colores como se describe aquí. Cada espectro calculado de FFT se dibujará en la cascada como una línea gráfica coloreada que sea uno o dos pixeles de alto (o ancho, dependiendo de la orientación). Por lo tanto, si la velocidad de desplazamiento se establece en 200 milisegundos, la cascada se moverá hacia abajo (o hacia la izquierda) en 10 píxeles gráficos por segundo. Pero: Si la CPU no puede mantenerse al día con la velocidad de la cascada, la cascada se desplazará más lento de lo que se define en la configuración de la pantalla Eso no es un error, es una característica -) El programa puede guardar periódicamente el contenido de la cascada. Ver acciones periódicas y programadas. Los usuarios experimentados pueden controlar la exhibición de la cascada vía comandos del intérprete (incluso de otras aplicaciones). Normalmente, la paleta de colores del espectrograma sólo se controla a través del control deslizante de contraste y brillo en el lado izquierdo de la ventana principal. Pero opcionalmente, puede activar el AGC visible en la segunda pestaña de la configuración de Spectrum Display. Técnicamente, el término control de ganancia automático AGC es un poco engañoso. De hecho, el AGC visual funciona de la siguiente manera: Al pintar una nueva línea en la cascada, el programa primero mide el nivel de ruido dentro del rango de frecuencias mostrado, como se explica aquí. A continuación, resta este valor (nivel real de ruido en dB) del valor de referencia, que se puede ajustar en la ventana de ajustes de pantalla (típicamente -100 dB). A continuación, esta diferencia (desviación) se pasa a través de un simple filtro de paso bajo, dependiendo de la velocidad visual AGC (lento / normal / rápido). Al pintar la cascada, la desviación filtrada paso bajo se agrega a todos los contenedores FFT, antes de convertirlos en valores de color. El AGC visual evita que la imagen del espectrograma no se vuelva demasiado oscura o demasiado brillante si cambia el nivel de la señal de entrada. Esto sucede, por ejemplo, si el espectrograma muestra una señal de radio de onda corta, y la pérdida de trayectoria cambia drásticamente, o (por alguna razón) el nivel de ruido local aumenta. Una de las desventajas del AGC visual es que no se puede determinar la intensidad de la señal (voltaje, potencia o lo que sea) del color en la pantalla del espectrograma. Usted puede ser engañado por el AGC, cuando una señal de banda estrecha desaparece, que de hecho es sólo abrumado por el ruido de banda ancha. Sin el AGC, usted habría visto que el ruido subió. Así que asegúrese de activar este AGC sólo si realmente necesita. Nota: Como recordatorio de que el AGC visual está habilitado, el control deslizante de brillo se marca b (minúsculas) cuando el AGC está activado. Para apagarlo, haga clic en el botón b para cambiarlo de nuevo a B (BAGC desactivado, el brillo sólo se controla a través del deslizador de brillo). Una barra de amplitud opcional se puede mostrar en el lado de la cascada. Puede mostrar el valor máximo de la señal de entrada en el dominio del tiempo. A diferencia de la pantalla de cascada, la barra de amplitud no está limitada a un cierto rango de frecuencia. A menudo se parece a un sismograma (y de hecho, se ha utilizado como tal ya): El fondo de la barra de amplitud es azul. La amplitud del primer canal de entrada añade color verde, la amplitud del segundo canal añade color rojo (si el analizador está configurado para el modo de canal dual, por supuesto). Así que si las barras de ambos canales se superponen, el resultado es blanco. Otros datos se pueden representar en la barra de amplitud, también. Por ejemplo, la curva roja en la captura de pantalla anterior muestra el nivel de ruido actual. El color del lápiz, el contenido y el rango de escala están definidos en la ventana del reloj (donde también se pueden representar en una ventana separada). Defina cuál de los canales de datos de las ventanas de vigilancia se representará en la barra de amplitud, abra la pantalla de configuración de la pantalla. El espectro 3D añade otra dimensión (el tiempo) a la pantalla, pero a menudo es menos fácil de leer que la pantalla de cascada. Para cambiar la ventana de visualización principal a 3D Spectrum, abra el cuadro de diálogo de visualización del espectro (desde el menú principal: Opciones ... Ajustes de pantalla), luego seleccione 3D Spectrum en la lista combinada denominada Mostrar. Es importante seleccionar una paleta de colores fuertes, con tantas transiciones de color como sea posible, y ajustar cuidadosamente el rango de amplitud mostrado. Sin una paleta de colores adecuada, apenas se verá nada en el espectro 3D. La paleta de colores se controla del mismo modo que para el espectrograma. Además, ayuda a activar la opción Amplitude Grid en los ajustes de visualización para una mejor legibilidad de las amplitudes. Pero aún así, en opinión de los autores, una visualización del espectro 3D no es particularmente adecuada para leer las amplitudes con precisión. Pero puede ayudar a ver las amplitudes (eje y) en función de la frecuencia (eje x) y el tiempo (eje z, aquí: apuntando desde el primer plano al fondo). Las opciones especiales (que sólo se aplican al espectro 3D) están en una pestaña adicional en la ventana de configuración. Además, las siguientes opciones también afectan a la visualización del espectro 3D: el color de fondo: definido en el panel Colores de visualización, etiquetado Spectrum Graph Background, el color utilizado para dibujar las escalas alrededor del gráfico: en el mismo panel, El espejo de la banda lateral inferior (en la 2ª pestaña de los ajustes de la pantalla), que invierte la escala de frecuencia, puede modificarse también en la ventana de configuración En determinadas condiciones, los espectrogramas reasignados proporcionan más resolución a lo largo de la Frecuencia y el eje de tiempo que el espectrograma clásico mostrado anteriormente. A modo de comparación, un espectrograma convencional ampliado (1ª) y un espectrograma reasignado tiempo / frecuencia (2º) con los mismos parámetros FFT. Más información sobre los espectrogramas reasignados en un documento separado algunas configuraciones con espectrogramas reasignados pueden ser recuperados desde el menú de configuración rápida. El correlograma es una función raramente utilizada. Es una representación gráfica especial de la similitud de dos señales, o la aleatoriedad en una señal. Más específico, puede utilizarse como un gráfico de correlación cruzada (si las dos entradas del analizador están conectadas a diferentes fuentes de señal), o un gráfico de autocorrelación (si ambas entradas están conectadas a la misma fuente. Cuidado sobre eso). El gráfico muestra una gráfica de las correlaciones r (h) versus h (los retrasos de tiempo). En Spectrum Lab, el correlograma utiliza los mismos bloques de muestra transformados con fourier que para el espectrograma normal. De hecho, el correlograma se ejecuta lado a lado con la visualización del espectro principal (espectro gráfico y / o espectrograma, como se explica en un capítulo anterior). Por esta razón, el intervalo de retardo de tiempo proporcionado por el correlacionador depende del tamaño FFT de la visualización del espectro principal. Ejemplo: Una tarjeta de sonido que entrega 11025 muestras / segundo, alimentando una FFT de 65536 puntos, llenará un buffer con 65536 puntos (en el dominio del tiempo) en 5,94 segundos. El intervalo de retardo máximo visualizable será de / - 2.97 segundos entonces, con el retardo cero en el medio. La siguiente captura de pantalla muestra los espectros y el correlograma de una señal de ruido fuerte con onda senoidal débil agregada. Se añadió una línea de retardo de 0,5 segundos (utilizando un circuito de prueba de SL) entre el generador de señales y el canal 1 del analizador. Canal 2 se alimentó directamente con la señal de prueba (sin retraso). Para activar esta visualización de correlación, seleccione Ver / Windows. Correlograma en el menú principal. Una prueba de correlación (como la descrita anteriormente) se encuentra en la carpeta de configuraciones SL, CorrTest1.usr. Si el analizador de espectro sólo está conectado a un canal de entrada, el correlograma (y el gráfico de correlación) mostrará la autocorrelación (correlación de la señal de entrada con sí mismo). El intervalo de retardo visualizado se puede modificar tirando de la escala con el ratón (del mismo modo que con la escala de frecuencia en los otros modos de visualización). La salida del correlador no está normalizada a la amplitud de entrada media. En lugar de ello, se escogió la siguiente convención de escala y signo (muy arbitrariamente): Una onda senoidal, con la máxima amplitud posible (justo debajo del punto de recorte) introducida en ambas entradas del analizador, producirá 100 salidas en el intervalo de tiempo en el que coinciden ambas señales. Si la señal en el canal 1 conduce la señal en el canal 2, la correlación máxima estará en cierto retraso positivo (no pregunte por qué). Si la señal en el canal 2 conduce la señal en el canal 1 (aka Ch1 retrasa Ch2), el máximo La correlación estará en cierto retraso negativo Debido a la ventana FFT, los coeficientes en los bordes de la ventana (retardos extremos) pueden ser atenuados. Esto puede ser compensado en una versión futura de SL, si es necesario para alguna aplicación (puede evitarse usando una ventana FFT rectangular). En este momento (enero de 2009), el correlator / correlograma es tan rara vez usado que poner más esfuerzo en ello no parece justificado. La escala de frecuencia visible se localiza entre el gráfico del espectro y la cascada (si ambos son visibles). Por lo general, es horizontal (eje X) y muestra sólo una parte del espectro de audio procesado (que está definido por los ajustes FFT). Puede agregar o restar un desplazamiento definido por el usuario si lo desea. También puede dividir la escala para ampliar en dos rangos independientes. La escala de frecuencia puede tener este aspecto: Los símbolos rómbicos coloreados en la escala de frecuencia son marcadores (pueden ser indicadores simples pero también elementos de control versátiles). Los marcadores se pueden controlar a través de comandos de intérprete en la tabla de marcadores de frecuencia. Que puede activar haciendo doble clic en un marcador. Puede mover un marcador manteniendo pulsado el botón izquierdo del ratón. Por ejemplo, un marcador de frecuencia puede conectarse a una frecuencia de generadores de señal, al oscilador local del convertidor de audiofrecuencia, a la frecuencia central AFC del decodificador digimodal, etc. Opcionalmente, la escala de frecuencia principal también puede mostrar las tres más importantes (Cambio de frecuencia como marcador cero de batido, frecuencia de borde inferior e inferior) del filtro de audio basado en FFT. Ejemplo: Para mostrar ciertas frecuencias de interés sin utilizar uno de los marcadores programables, se puede cargar una Lista de frecuencias de estaciones de radio en Spectrum Lab. Las frecuencias de las estaciones de radio aparecen como líneas de color fino en la escala de frecuencia principal y en el gráfico del espectro. (Espectro de VLF / espectrograma con la pantalla de la estación de radio) Al hacer clic en la escala de frecuencia (en una frecuencia particular de interés, no en uno de los marcadores de frecuencia) con el botón derecho del ratón, se abre el menú emergente de escalas de frecuencia: Funciones. La mayoría de las entradas deben hablar por sí mismas, algunas se explican en los próximos capítulos. Ajuste de la parte visible de la escala de frecuencia El rango de frecuencia visualizado puede modificarse tirando de la escala de frecuencia visible con el ratón (botón izquierdo presionado). O haga clic con el botón derecho en la parte interesante de la escala de frecuencia y seleccione Zoom In o Zoom Out en el menú emergente. Alternativamente, puede ingresar las frecuencias de borde (Min Max) en el panel de control de frecuencias en el lado izquierdo de la ventana principal: (panel de control de escala de frecuencia) Más información sobre el panel de control de frecuencia está aquí. Se puede activar desde el cuadro de diálogo de configuración de la pantalla o desde un menú emergente que se abre al hacer clic en la escala de frecuencia con el botón derecho del ratón. Utilícelo, por ejemplo, si desea tener una superposición de banda de audio en el lado izquierdo de la pantalla y una visualización ampliada de un cierto rango de frecuencias en el lado derecho. El separador entre ambas secciones de escala se puede mover con el ratón (no necesariamente en el centro de la pantalla). Nota: Si se ajusta la escala de frecuencia de división de opción, pero sólo un canal de entrada activo para el analizador de espectro, ambas secciones muestran diferentes rangos de frecuencia de la misma señal. Si dos canales de entrada están activos para el analizador de espectro (mostrando diferentes señales en una pantalla), la escala de frecuencia se dividirá en dos secciones automáticamente. Para modificar el rango de frecuencias de una sección de escala de frecuencia, primero haga clic en la sección en la escala de frecuencia visible. El panel de control de la escala de frecuencia mostrará Freq1 o Freq2 en lugar de Freq, y los campos de edición se aplicarán a una sola sección. Agregar o sustraer un desfase de frecuencia definido por el usuario (para la pantalla) En el panel de control de frecuencia, puede introducir un desplazamiento de frecuencia que se agregará a la frecuencia visualizada. Esto no afecta el procesamiento interno, es sólo para la óptica. Si desea SUBTRACTAR la frecuencia visualizada desde un determinado valor (por ejemplo, porque tiene un receptor LSB sintonizado a 138kHz), introduzca el valor -138k en este campo. Después de tres segundos, el valor introducido se activará (el valor introducido se normalizará) y la escala de frecuencia se actualizará con los nuevos ajustes. (Nota: para los receptores LSB, debe activar adicionalmente el espejo LSB en el menú de configuración). No importa si SL está configurado para una o dos entradas de la tarjeta de sonido, el analizador de frecuencia principal puede ser cambiado al modo de canal dual. Ambos canales pueden ser conectados en diferentes puntos del circuito de prueba, por ejemplo, el canal 1 se puede conectar a la entrada de audio izquierda y el canal 2 a la entrada de audio derecha. O, el canal 1 puede estar conectado a la señal de entrada (antes de la cadena DSP) y 2 a la señal de salida (que va al convertidor D / A). La selección de canales se puede modificar en la ventana de circuitos / componentes, que se puede abrir desde el menú Ver / Windows. Si dos canales de entrada están activos para el analizador de espectro (que muestra dos señales diferentes en una pantalla), la escala de frecuencia se dividirá en dos secciones automáticamente. Para algunas aplicaciones especiales de señal débil, Spectrum Lab ofrece diferentes formas y etapas de promediación. Averaging can be superior to simply increasing the FFT size, if the observed signal is broad (incoherent phase-, frequency - or amplitude modulated, etc). There are various stages of (spectrum-) averaging, which will be explained in some depth later: Internal average at the FFT-calculating stage: This is a simple averaging of powers (or energies), directly after the FFT calculation, using a leaky integrator. This kind of averaging is always possible, even if the waterfall scrolls faster than the time required to collect new data (in the time domain) for a single FFT. It is configured on the FFT panel in the internal average field. This kind of averaging can help to see weak signals in the waterfall display, at the expense of smearing along the time axis. Waterfall line average: If the waterfall scroll interval is longer than the time to aquire data for a new FFT, a larger number of FFTs will be calculated and added, before a new line is added to the waterfall display (and shown in the spectrum graph). This kind of averaging is active when the scroll interval (tscroll) matches the following criterion, and the option optimum waterfall average is selected in the Display Settings: tscroll gt (FFTsize / sampling rate) . The number of FFTs added this way (into a single spectrum, which will then be displayed in the graph and/or waterfall) depends on the waterfall scrolling speed, the audio sampling rate, and the FFT size. The interpreter function water. avrgmax returns the number of FFTs added in each line of the waterfall (you can use this function to calculate the gain from this incoherent averaging, as explained somewhere below). Unlike the first average option (internal average), this kind of averaging does not cause a smeared display, for the expense of a slowly scrolling waterfall. Triggered average. This special kind of averaging only works when the waterfall screen runs in triggered, non-scrolling mode. It can only be used for periodic signals, for example in the low power moon radar experiment, where a large number of VHF pulses were sent to the moon, and the reflections collected over a long time before they became visible on the spectrogram (which was synchronized with the transmit/receive interval). To configure this kind of averaging, open the 3rd() tab of the Spectrum Display options (with the panel Options for Triggered Spectrogram). Set the checkmark for triggered spectrum, and set the trigger control to one SWEEP of the spectrogram (one waterfall screen). Details about this special kind of averaging can be found in the Alpha VLF beacon example . To test the triggered average spectrogram without an off-air signal, load the configuration TrigSpectTest1.usr, which is contained in the installer (subdirectory configurations). Long term average (spectrum). This option was added for the Earth-Venus-Earth experiment at the IUZ Bochum in 2007. The long-term average is basically a second stage of averaging (after the FFT internal average and the Waterfall line average. Later (in 2011), an optional exponential decay was added for the long-term average. The long-term average can be enabled on the first part of the Spectrum Display Settings. The long-term average spectrum display works as follows: All spectra (FFTs) which are displayed on the waterfall are added to the so-called long-term average (with some optional preprocessing, as described in the document about the Earth-Venus-Earth experiment). The long-term average spectrum is displayed only as an additional curve in the Spectrum Graph window (not in the waterfall ). This is typically a red curve, but the colour may be modified through menu Options..Spectrum Display Settings (part 3 ). When active, the long-term average is painted with the fifth pen (Pen 5, which is RED by default), as defined on the Display Colours panel. The total number of FFTs added in the long-term spectrum average can be calculated with this formula (to show it on one of the programmable buttons. as used in the Earth-Venus-Earth configuration): spa. ltacntwater. avrgmax water. avrgcnt , where : spa. ltacnt total number of waterfall lines() added in the long-term average spectrum, water. avrgmax number of FFTs added in each line of the waterfall (waterfall line average), water. avrgcnt number of FFT added in the current (still invisible) waterfall line . The long-term average can be cleared through the popup menu of the spectrum graph. Right-click into the graph, then (in the popup menu) select Spectrum Graph Options. Clear long-term average. In the same popup menu, the curves for the long-term average and the momentary spectrum can be turned on and off. Alternatively, the long-term average can be cleared with the command spa. clearavrg . In the EVE-configurations, one of the programmable buttons is used for this purpose. Since 2008-03, the long-term-average spectrum can also be exported as a textfile. controlled by the interpreter . Since 2011-11, an optional exponential decay can be configured for the long-term average. The decay rate is specified as the half-life interval (auf Deutsch: Halbwertszeit), measured in minutes, on the first panel of the Spectrum Display settings. close to the checkmark which enables the long-term average spectrum in the main spectrum display. Note that the counter of spectra added into the long-term average buffer is also affected by the exponential decay, thus even the counter value (spa. ltacnt ) may be a fractional (non-integer) value, which is unusual for a counter - but thats the way it is. If the half-life interval is nonzero, the counter will asymptotically approach an upper boundary value, which depends on the waterfall scroll rate (i. e. the interval at which new FFTs are calculated), and the half-life time. FFT Smoothing. Doesnt calculate an average from consecutive FFTs, but on neighbouring frequency bins within a single FFT. Together with the other averaging options mentioned above, this may help to reduce the visible noise in the spectrum display if you are looking for very weak signals. Details about FFT(-bin)-smoothing are here. This is a simple second spectrum analyser, not as versatile as the display in the main window. You can use it to display another portion of the spectrum, or analyze another audio source if you have a stereo soundcard (or 2-channel ADC). To open a window the second spectrogram, enter the View/Windows menu of the main window, then select Second Spectrogram. To activate the spectrum analyser for the second window, and select the source, use the Mode menu of the second spectrogram window. Notes: You can also activate the second spectrogram from SpecLabs circuit/component window. where you can also see where the input for this analyser comes from. Click on the small source label to open a list of all available sources. Some interpreter functions like peaka and peakf can operate on the spectrum from the second spectrum analyser also. Last modified: 2017-12-09: Added width and size info in the embedded images, so they will be correctly sized when converting the help system info PDF (doc/SpecLabManual. pdf ).Smoothing In many experiments in science, the true signal amplitudes (y-axis values) change rather smoothly as a function of the x-axis values, whereas many kinds of noise are seen as rapid, random changes in amplitude from point to point within the signal. In the latter situation it may be useful in some cases to attempt to reduce the noise by a process called smoothing . In smoothing, the data points of a signal are modified so that individual points that are higher than the immediately adjacent points (presumably because of noise) are reduced, and points that are lower than the adjacent points are increased. This naturally leads to a smoother signal (and a slower step response to signal changes) . As long as the true underlying signal is actually smooth, then the true signal will not be much distorted by smoothing, but the noise will be reduced. In terms of the frequency components of a signal, a smoothing operation acts as a low-pass filter. reducing the high-frequency components and passing the low-frequency components with little change. Smoothing algorithms . Most smoothing algorithms are based on the shift and multiply technique, in which a group of adjacent points in the original data are multiplied point-by-point by a set of numbers (coefficients) that defines the smooth shape, the products are added up and divided by the sum of the coefficients, which becomes one point of smoothed data, then the set of coefficients is shifted one point down the original data and the process is repeated. The simplest smoothing algorithm is the rectangular boxcar or unweighted sliding-average smooth it simply replaces each point in the signal with the average of m adjacent points, where m is a positive integer called the smooth width . For example, for a 3-point smooth ( m 3): for j 2 to n-1, where S j the j th point in the smoothed signal, Y j the j th point in the original signal, and n is the total number of points in the signal. Similar smooth operations can be constructed for any desired smooth width, m . Usually m is an odd number. If the noise in the data is white noise (that is, evenly distributed over all frequencies) and its standard deviation is s . then the standard deviation of the noise remaining in the signal after the first pass of an unweighted sliding-average smooth will be approximately s over the square root of m ( s /sqrt( m )), where m is the smooth width. Despite its simplicity, this smooth is actually optimum for the common problem of reducing white noise while keeping the sharpest step response . The response to a step change is in fact linear . so this filter has the advantage of responding completely with no residual effect withing its response time . which is equal to the smooth width divided by the sampling rate. The triangular smooth is like the rectangular smooth, above, except that it implements a weighted smoothing function. For a 5-point smooth ( m 5): for j 3 to n-2, and similarly for other smooth widths (see the spreadsheet UnitGainSmooths. xls ). In both of these cases, the integer in the denominator is the sum of the coefficients in the numerator, which results in a unit-gain smooth that has no effect on the signal where it is a straight line and which preserves the area under peaks. It is often useful to apply a smoothing operation more than once, that is, to smooth an already smoothed signal, in order to build longer and more complicated smooths. For example, the 5-point triangular smooth above is equivalent to two passes of a 3-point rectangular smooth. Three passes of a 3-point rectangular smooth result in a 7-point pseudo-Gaussian or haystack smooth, for which the coefficients are in the ratio 1:3:6:7:6:3:1. The general rule is that n passes of a w - width smooth results in a combined smooth width of n w - n 1. For example, 3 passes of a 17-point smooth results in a 49-point smooth. These multi-pass smooths are more effective at reducing high-frequency noise in the signal than a rectangular smooth but exhibit slower step response. In all these smooths, the width of the smooth m is chosen to be an odd integer, so that the smooth coefficients are symmetrically balanced around the central point, which is important because it preserves the x-axis position of peaks and other features in the signal. (This is especially critical for analytical and spectroscopic applications because the peak positions are often important measurement objectives). Note that we are assuming here that the x-axis intervals of the signal is uniform, that is, that the difference between the x-axis values of adjacent points is the same throughout the signal. This is also assumed in many of the other signal-processing techniques described in this essay, and it is a very common (but not necessary) characteristic of signals that are acquired by automated and computerized equipment. The Savitzky-Golay smooth is based on the least-squares fitting of polynomials to segments of the data. The algorithm is discussed in www. wire. tu-bs. de/OLDWEB/mameyer/cmr/savgol. pdf. Compared to the sliding-average smooths, the Savitzky-Golay smooth is less effective at reducing noise, but more effective at retaining the shape of the original signal. It is capable of differentiation as well as smoothing. The algorithm is more complex and the computational times are greater than the smooth types discussed above, but with modern computers the difference is not significant and code in various languages is widely available online. See SmoothingComparison . The shape of any smoothing algorithm can be determined by applying that smooth to a delta function . a signal consisting of all zeros except for one point, as demonstrated by the simple Matlab/Octave script DeltaTest. m . Noise reduction . Smoothing usually reduces the noise in a signal. If the noise is white (that is, evenly distributed over all frequencies) and its standard deviation is s . then the standard deviation of the noise remaining in the signal after one pass of a rectangular smooth will be approximately s /sqrt( m ), where m is the smooth width. If a triangular smooth is used instead, the noise will be slightly less, about s 0.8/sqrt( m ). Smoothing operations can be applied more than once: that is, a previously-smoothed signal can be smoothed again. In some cases this can be useful if there is a great deal of high-frequency noise in the signal. However, the noise reduction for white noise is less in each successive smooth. For example, three passes of a rectangular smooth reduces white noise by a factor of approximately s 0.7/sqrt( m ), only a slight improvement over two passes. The frequency distribution of noise, designated by noise color. substantially effects the ability of smoothing to reduce noise. The Matlab/Octave function NoiseColorTest. m compares the effect of a 100-point boxcar (unweighted sliding average) smooth on the standard deviation of white, pink, and blue noise, all of which have an original unsmoothed standard deviation of 1.0. Because smoothing is a low-pass filter process, it effects low frequency (pink) noise less, and high-frequency (blue) noise more, than white noise. End effects and the lost points problem. Note in the equations above that the 3-point rectangular smooth is defined only for j 2 to n-1. There is not enough data in the signal to define a complete 3-point smooth for the first point in the signal (j 1) or for the last point (j n). because there are no data points before the first point or after the last point. (Similarly, a 5-point smooth is defined only for j 3 to n-2, and therefore a smooth can not be calculated for the first two points or for the last two points). In general, for an m - width smooth, there will be ( m -1)/2 points at the beginning of the signal and ( m -1)/2 points at the end of the signal for which a complete m - width smooth can not be calculated. What to do There are two approaches. One is to accept the loss of points and trim off those points or replace them with zeros in the smooth signal. (Thats the approach taken in most of the figures in this paper). The other approach is to use progressively smaller smooths at the ends of the signal, for example to use 2, 3, 5, 7. point smooths for signal points 1, 2, 3,and 4. and for points n, n-1, n-2, n-3. respectivamente. The later approach may be preferable if the edges of the signal contain critical information, but it increases execution time. The fastsmooth function discussed below can utilize either of these two methods. Examples of smoothing . A simple example of smoothing is shown in Figure 4. The left half of this signal is a noisy peak. The right half is the same peak after undergoing a triangular smoothing algorithm. The noise is greatly reduced while the peak itself is hardly changed. Smoothing increases the signal-to-noise ratio and allows the signal characteristics (peak position, height, width, area, etc.) to be measured more accurately by visual inspection. Figure 4. The left half of this signal is a noisy peak. The right half is the same peak after undergoing a smoothing algorithm. The noise is greatly reduced while the peak itself is hardly changed, making it easier to measure the peak position, height, and width directly by graphical or visual estimation (but it does not improve measurements made by least-squares methods see below ). The larger the smooth width, the greater the noise reduction, but also the greater the possibility that the signal will be distorted by the smoothing operation. The optimum choice of smooth width depends upon the width and shape of the signal and the digitization interval. For peak-type signals, the critical factor is the smoothing ratio . the ratio between the smooth width m and the number of points in the half-width of the peak. In general, increasing the smoothing ratio improves the signal-to-noise ratio but causes a reduction in amplitude and in increase in the bandwidth of the peak. The figures above show examples of the effect of three different smooth widths on noisy Gaussian-shaped peaks. In the figure on the left, the peak has a (true) height of 2.0 and there are 80 points in the half-width of the peak. The red line is the original unsmoothed peak. The three superimposed green lines are the results of smoothing this peak with a triangular smooth of width (from top to bottom) 7, 25, and 51 points. Because the peak width is 80 points, the smooth ratios of these three smooths are 7/80 0.09, 25/80 0.31, and 51/80 0.64, respectively. As the smooth width increases, the noise is progressively reduced but the peak height also is reduced slightly. For the largest smooth, the peak width is slightly increased. In the figure on the right, the original peak (in red) has a true height of 1.0 and a half-width of 33 points. (It is also less noisy than the example on the left.) The three superimposed green lines are the results of the same three triangular smooths of width (from top to bottom) 7, 25, and 51 points. But because the peak width in this case is only 33 points, the smooth ratios of these three smooths are larger - 0.21, 0.76, and 1.55, respectively. You can see that the peak distortion effect (reduction of peak height and increase in peak width) is greater for the narrower peak because the smooth ratios are higher. Smooth ratios of greater than 1.0 are seldom used because of excessive peak distortion. Note that even in the worst case, the peak positions are not effected (assuming that the original peaks were symmetrical and not overlapped by other peaks). If retaining the shape of the peak is more important than optimizing the signal-to-noise ratio, the Savitzky-Golay has the advantage over sliding-average smooths. In all cases, the total area under the peak remains unchanged. The problem with smoothing is that it is often less beneficial than you might think . Its very important to point out that smoothing results such as illustrated in the figure above may be deceptively impressive because they employ a single sample of a noisy signal that is smoothed to different degrees. This causes the viewer to underestimate the contribution of low-frequency noise, which is hard to estimate visually because there are so few low-frequency cycles in the signal record. This problem can visualized by recording a number of independent samples of a noisy signal consisting of a single peak, as illustrated in the two figures below. These figures show ten superimposed plots with the same peak but with independent white noise, each plotted with a different line color, unsmoothed on the left and smoothed on the right. Inspection of the smoothed signals on the right clearly shows the variation in peak position, height, and width between the 10 samples caused by the low frequency noise remaining in the smoothed signals. Just because a signal looks smooth does not mean there is no noise. Low-frequency noise remaining in the signals after smoothing will still interfere with precise measurement of peak position, height, and width. It should be clear that smoothing can seldom completely eliminate noise, because most noise is spread out over a wide range of frequencies, and smoothing simply reduces the noise in part of its frequency range. Only for some very specific types of noise (e. g. discrete frequency noise or single-point spikes) is there hope of anything close to complete noise elimination. The figure on the right below is another example signal that illustrates some of these principles. The signal consists of two Gaussian peaks, one located at x50 and the second at x150. Both peaks have a peak height of 1.0 and a peak half-width of 10, and a normally-distributed random white noise with a standard deviation of 0.1 has been added to the entire signal. The x-axis sampling interval, however, is different for the two peaks its 0.1 for the first peak (from x0 to 100) and 1.0 for the second peak (from x100 to 200). This means that the first peak is characterized by ten times more points that the second peak. It may look like the first peak is noisier than the second, but thats just an illusion the signal-to-noise ratio for both peaks is 10. The second peak looks less noisy only because there are fewer noise samples there and we tend to underestimate the dispersion of small samples. The result of this is that when the signal is smoothed, the second peak is much more likely to be distorted by the smooth (it becomes shorter and wider) than the first peak. The first peak can tolerate a much wider smooth width, resulting in a greater degree of noise reduction. (Similarly, if both peaks are measured with the least-squares curve fitting method, the fit of the first peak is more stable with the noise and the measured parameters of that peak will be about 3 times more accurate than the second peak, because there are 10 times more data points in that peak, and the measurement precision improves roughly with the square root of the number of data points if the noise is white). You can download the data file udx in TXT format or in Matlab MAT format. Optimization of smoothing. As smoothing ratio increases, noise is reduced quickly at first, then more slowly, and the peak height is also reduced, slowly at first, then more quickly. The result is that the signal-to-noise increases quickly at first, then reaches a maximum. This is illustrated in the figure on the left for a Gaussian peak with white noise (produced by the Matlab/Octave script SmoothWidthTest. m ). Which is the best smooth ratio It depends on the purpose of the peak measurement. If the objective of the measurement is to measure the true peak height and width, then smooth ratios below 0.2 should be used and the Savitzky-Golay smooth is preferred. Measuring the height of noisy peaks is much better done by curve fitting the unsmoothed data rather than by taking the maximum of the smoothed data (see CurveFittingCSmoothing ). But if the objective of the measuremen t is to measure the peak position (x-axis value of the peak), much larger smooth ratios can be employed if desired, because smoothing has little effect on the peak position (unless peak is asymmetrical or the increase in peak width is so much that it causes adjacent peaks to overlap). In quantitative analysis applications based on calibration by standard samples, the peak height reduction caused by smoothing is not so important. If the same signal processing operations are applied to the samples and to the standards, the peak height reduction of the standard signals will be exactly the same as that of the sample signals and the effect will cancel out exactly. In such cases smooth widths from 0.5 to 1.0 can be used if necessary to further improve the signal-to-noise ratio, as shown in the figure on the left (for a simple sliding-average rectangular smooth). In practical analytical chemistry, absolute peak height measurements are seldom required calibration against standard solutions is the rule. (Remember: the objective of quantitative analysis is not to measure a signal but rather to measure the concentration of the analyte.) It is very important, however, to apply exactly the same signal processing steps to the standard signals as to the sample signals, otherwise a large systematic error may result. For a more detailed comparison of all four smoothing types considered above, see SmoothingComparison . (a) for cosmetic reasons, to prepare a nicer-looking or more dramatic graphic of a signal for visual inspection or publications, specifically in order to emphasize long-term behavior over short-term . or (b) if the signal will be subsequently analyzed by a method that would be degraded by the presence of too much high-frequency noise in the signal, for example if the heights of peaks are to be determined visually or graphically or by using the MAX function, or if the location of maxima, minima, or inflection points in the signal is to be determined automatically by detecting zero-crossings in derivatives of the signal. Optimization of the amount and type of smoothing is very important in these cases (see DifferentiationSmoothing ). But generally, if a computer is available to make quantitative measurements, its better to use least-squares methods on the unsmoothed data, rather than graphical estimates on smoothed data. If a commercial instrument has the option to smooth the data for you, its best to disable smoothing that and record the unsmoothed data you can always smooth it later yourself for visual presentation and it will be better to use the unsmoothed data for an least-squares fitting or other processing that you may want to do later. Smoothing can be used to locate peaks but it should not be used to measure peaks . Care must be used in the design of algorithms that employ smoothing. For example, in a popular technique for peak finding and measurement. peaks are located by detecting downward zero-crossings in the smoothed first derivative. but the position, height, and width of each peak is determined by least-squares curve-fitting of a segment of original unsmoothed data in the vicinity of the zero-crossing. That way, even if heavy smoothing is necessary to provide reliable discrimination against noise peaks, the peak parameters extracted by curve fitting are not distorted by the smoothing. (a) smoothing will not significantly improve the accuracy of parameter measurement by least-squares measurements between separate independent signal samples, (b) all smoothing algorithms are at least slightly lossy, entailing at least some change in signal shape and amplitude, (c) it is harder to evaluate the fit by inspecting the residuals if the data are smoothed, because smoothed noise may be mistaken for an actual signal. and (d) smoothing the signal will seriously underestimate the parameters errors predicted by propagation-of-error calculations and the bootstrap method . Dealing with spikes and outliers. Sometimes signals are contaminated with very tall, narrow spikes or outliers occurring at random intervals and with random amplitudes, but with widths of only one or a few points. It not only looks ugly, but it also upsets the assumptions of least-squares computations because it is not normally-distributed random noise. This type of interference is difficult to eliminate using the above smoothing methods without distorting the signal. However, a median filter, which replaces each point in the signal with the median (rather than the average) of m adjacent points, can completely eliminate narrow spikes with little change in the signal, if the width of the spikes is only one or a few points and equal to or less than m . See en. wikipedia. org/wiki/Medianfilter. The killspikes. m function is another spike-removing function that uses a different approach, which locates and eliminates the spikes and patches over them using linear interpolation from the signal before and after. Unlike conventional smooths, these functions can be profitably applied prior to least-squares fitting functions. (On the other hand, if its the spikes that are actually the signal of interest, and other components of the signal are interfering with their measurement, see CaseStudiesG ). An alternative to smoothing to reduce noise in the above set of unsmoothed signals is ensemble averaging. which can be performed in this case very simply by the Matlab/Octave code plot(x, mean(y)) the result shows a reduction in white noise by about sqrt(10)3.2. This is enough to judge that there is a single peak with Gaussian shape, which can best be measured by curve fitting (covered in a later section ) using the Matlab/Octave code peakfit(xmean(y),0,0,1) , with the result showing excellent agreement with the position, height, and width of the Gaussian peak created in the third line of the generating script (above left). Condensing oversampled signals . Sometimes signals are recorded more densely (that is, with smaller x-axis intervals) than really necessary to capture all the important features of the signal. This results in larger-than-necessary data sizes, which slows down signal processing procedures and may tax storage capacity. To correct this, oversampled signals can be reduced in size either by eliminating data points (say, dropping every other point or every third point) or by replacing groups of adjacent points by their averages. The later approach has the advantage of using rather than discarding extraneous data points, and it acts like smoothing to provide some measure of noise reduction. (If the noise in the original signal is white, and the signal is condensed by averaging every n points, the noise is reduced in the condensed signal by the square root of n. but with no change in frequency distribution of the noise). Video Demonstration. This 18-second, 3 MByte video (Smooth3.wmv ) demonstrates the effect of triangular smoothing on a single Gaussian peak with a peak height of 1.0 and peak width of 200. The initial white noise amplitude is 0.3, giving an initial signal-to-noise ratio of about 3.3. An attempt to measure the peak amplitude and peak width of the noisy signal, shown at the bottom of the video, are initially seriously inaccurate because of the noise. As the smooth width is increased, however, the signal-to-noise ratio improves and the accuracy of the measurements of peak amplitude and peak width are improved. However, above a smooth width of about 40 (smooth ratio 0.2), the smoothing causes the peak to be shorter than 1.0 and wider than 200, even though the signal-to-noise ratio continues to improve as the smooth width is increased. (This demonstration was created in Matlab 6.5. SPECTRUM, the freeware Macintosh signal-processing application, includes rectangular and triangular smoothing functions for any number of points. Spreadsheets. Smoothing can be done in spreadsheets using the shift and multiply technique described above. In the spreadsheets smoothing. ods and smoothing. xls the set of multiplying coefficients is contained in the formulas that calculate the values of each cell of the smoothed data in columns C and E. Column C performs a 7-point rectangular smooth (1 1 1 1 1 1 1) and column E does a 7-point triangular smooth (1 2 3 4 3 2 1), applied to the data in column A. You can type in (or Copy and Paste) any data you like into column A, and you can extend the spreadsheet to longer columns of data by dragging the last row of columns A, C, and E down as needed. But to change the smooth width, you would have to change the equations in columns C or E and copy the changes down the entire column. Its common practice to divide the results by the sum of the coefficients so that the net gain is unity and the area under the curve of the smoothed signal is preserved. The spreadsheets UnitGainSmooths. xls and UnitGainSmooths. ods contain a collection of unit-gain convolution coefficients for rectangular, triangular, and Gaussian smooths of width 3 to 29 in both vertical (column) and horizontal (row) format. You can Copy and Paste these into your own spreadsheets. The spreadsheets MultipleSmoothing. xls and MultipleSmoothing. ods demonstrate a more flexible method in which the coefficients are contained in a group of 17 adjacent cells (in row 5, columns I through Y), making it easier to change the smooth shape and width (up to a maximum of 17). In this spreadsheet, the smooth is applied three times in succession, resulting in an effective smooth width of 49 points applied to column G. Compared to Matlab/Octave, spreadsheets are much slower, less flexible, and less easily automated. For example, in these spreadsheets, to change the signal or the number of points in the signal, or to change the smooth width or type, you have to modify the spreadsheet in several spaces, whereas to do the same using the Matlab/Octave fastsmooth function (below), you need only change in input arguments of a single line of code. And combining several different techniques into one spreadsheet is more complicated than writing a Matlab/Octave script that does the same thing. Smoothing in Matlab and Octave . The custom function fastsmooth implements shift and multiply type smooths using a recursive algorithm. (Click on this link to inspect the code, or right-click to download for use within Matlab). Fastsmooth is a Matlab function of the form sfastsmooth(a, w, type, edge) . The argument a is the input signal vector w is the smooth width (a positive integer) type determines the smooth type: type1 gives a rectangular (sliding-average or boxcar) smooth type2 gives a triangular smooth, equivalent to two passes of a sliding average type3 gives a pseudo-Gaussian smooth, equivalent to three passes of a sliding average. (See SmoothingComparison for a comparison of these smoothing modes). The argument edge controls how the edges of the signal (the first w/2 points and the last w/2 points) are handled. If edge0, the edges are zero. (In this mode the elapsed time is independent of the smooth width. This gives the fastest execution time). If edge1, the edges are smoothed with progressively smaller smooths the closer to the end. (In this mode the execution time increases with increasing smooth widths). The smoothed signal is returned as the vector s. (You can leave off the last two input arguments: fastsmooth(Y, w,type) smooths with edge0 and fastsmooth(Y, w) smooths with type1 and edge0). Compared to convolution-based smooth algorithms, fastsmooth uses a simple recursive algorithm that typically gives much faster execution times, especially for large smooth widths it can smooth a 1,000,000 point signal with a 1,000 point sliding average in less than 0.1 second. Heres a simple example of fastsmooth demonstrating the effect on white noise (graphic ). SmoothWidthTest. m is a simple script that uses the fastsmooth function to demonstrate the effect of smoothing on peak height, noise, and signal-to-noise ratio of a peak. You can change the peak shape in line 7, the smooth type in line 8, and the noise in line 9. A typical result for a Gaussian peak with white noise smoothed with a pseudo-Gaussian smooth is shown on the left. Here, as it is for most peak shapes, the optimal signal-to-noise ratio occurs at a smooth ratio of about 0.8. However, that optimum corresponds to a significant reduction in the peak height . which could be a serious problem. A smooth width about half the width of the original unsmoothed peak produces less distortion of the peak but still achieves a reasonable noise reduction. This effect is explored more completely by the text below, which shows an experiment in Matlab or Octave that creates a Gaussian peak, smooths it, compares the smoothed and unsmoothed version, then uses the peakfit. m function (version 3.4 or later) to show that smoothing reduces the peak height (from 1 to 0.786) and increases the peak width (from 1.66 to 2.12), but has no effect on the total peak area (as long as you measure the total area under the broadened peak). Smoothing is useful if the signal is contaminated by non-normal noise such as sharp spikes or if the peak height, position, or width are measured by simple methods, but there is no need to smooth the data if the noise is white and the peak parameters are measured by least-squares methods, because the results obtained on the unsmoothed data will be more accurate (see CurveFittingCSmoothing ). gtgt FitResults, FitErrorpeakfit(x y) FitResults Peak Position Height Width Area 1 5 1 1.6651 1.7725 FitError 3.817e-005 gtgt FitResults, FitErrorpeakfit(x ysmoothed) FitResults 1 5 0.78608 2.1224 1.7759 FitError 0.13409 The Matlab/Octave user-defined function condense. m. condense(y, n). returns a condensed version of y in which each group of n points is replaced by its average, reducing the length of y by the factor n. (For x, y data sets, use this function on both independent variable x and dependent variable y so that the features of y will appear at the same x values). The Matlab/Octave user-defined function medianfilter. m. medianfilter(y, w). performs a median-based filter operation that replaces each value of y with the median of w adjacent points (which must be a positive integer). ProcessSignal is a Matlab/Octave command-line function that performs smoothing and differentiation on the time-series data set x, y (column or row vectors). It can employ all the types of smoothing described above. Type help ProcessSignal. Returns the processed signal as a vector that has the same shape as x, regardless of the shape of y. The syntax is ProcessedProcessSignal(x, y, DerivativeMode, w, type, ends, Sharpen, factor1, factor2, SlewRate, MedianWidth) iSignal is an interactive function for Matlab that performs smoothing for time-series signals using all the algorithms discussed above, including the Savitzky-Golay smooth, a median filter, and a condense function, with keystrokes that allow you to adjust the smoothing parameters continuously while observing the effect on your signal instantly, making it easy to observe how different types and amounts of smoothing effect noise and signal (such as the height, width, and areas of peaks). Other functions include differentiation, peak sharpening, interpolation, least-squares peak measurement, and a frequency spectrum mode that shows how smoothing and other functions can change the frequency spectrum of your signals. The simple script iSignalDeltaTest demonstrates the frequency response of iSignals smoothing functions by applying them to a single-point spike. allowing you to change the smooth type and the smooth width to see how the the frequency response changes. View the code here or download the ZIP file with sample data for testing. iSignal for Matlab. Click to view larger figures. Note: you can right-click on any of the m-file links on this site and select Save Link As. to download them to your computer for use within Matlab. Unfortunately, iSignal does not currently work in Octave.

No comments:

Post a Comment