Approach for Noise Comparison

Illustration
Isaiah - 2021-02-19T11:02:11+00:00
Question: Approach for Noise Comparison

Assuming I have two output signals measured from two different power supplies, I want to compare the noise-levels of these output  signals to find out which one of them the noisier one. The data of the input is also available.   However the noise-free output signals are unknown (we have only the noisy signals). Therefore comparing their Signal-to-Noise ratios wouldn't be possible. Is there another approach to do such comparison in MATLAB?

Expert Answer

Profile picture of John Michell John Michell answered . 2025-11-20

If the signal is a DC voltage, simply use std() to take the standard deviation. If the power supply supplies an AC voltage (sine wave), fit the signal to a cubic with sgolayfilt() - a Savitzky-Golay filter which is like a sliding polynomial filter - and then subtract the fitted  signal from the actual signal to get the noise. You know that sine and cosine waves can be modeled as polynomials from the Taylor series expansion, so I'd go no higher than 3rd or 4th order on the Savitzky-Golay filter. sgolayfilt() is in the signal Processing Toolbox and I attach a demo. If you don't have that toolbox you can use rloess or rsmooth in the Curve Fitting Toolbox.

clc;    % Clear the command window.
close all;  % Close all figures (except those of imtool.)
clear;  % Erase all existing variables. Or clearvars if you want.
workspace;  % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 25;

% Make a noisy sine wave signal
x = 1 : 300;
period = 50
y = sin(2*pi*x/period);
noiseAmplitude = 0.8;
y = y + noiseAmplitude * rand(size(y));
subplot(2,1,1);
plot(x, y, 'b-', 'LineWidth', 2);
grid on;
title('Noisy Signal', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off') 

% Now smooth with a Savitzky-Golay sliding polynomial filter
windowWidth = 27
polynomialOrder = 3
smoothY = sgolayfilt(y, polynomialOrder, windowWidth);
subplot(2,1,2);
plot(x, smoothY, 'b-', 'LineWidth', 2);
grid on;
title('Smoothed Signal', 'FontSize', fontSize);


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!