Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Calculating the THD, SNR and Bandwith of amplifier

Status
Not open for further replies.

Violet_AGH

Newbie level 2
Joined
Dec 7, 2015
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
18
Hi!

I've made the measurement of signal (with oscilloscope) and noise of the amplifiers. I have put them on svanpc and put the into Matlab.
My task is to calculate the SNR, THD and the bandwith. And I have no idea what I am doing. I have got some numbers but I think it's all wrong (SNR=18,24dB, I dont think it should looks like this). It also look very short so I have to do somenthing wrong, something like everything. Can anyone tell me where I do mistakes? Thank you in advance.


Here is my code. I cut some data to make look this better (I had 100 samples, let's make only 10)

Code:
f = [0.0	256.0	 512.0 768.0	1024.0	1280.0	1536.0	1792.0	2048.0	2304.0];

Lev_noise_input=	[3.16e-02(TOTAL)	5.25e-03	2.57e-03	1.93e-03	2.40e-03	3.02e-03	3.51e-03	3.76e-03	4.57e-03	5.56e-03	];

Lev_signal_input =	[1.43e-02(TOTAL)	7.76e-05	2.69e-04	8.13e-03	1.43e-02	6.17e-03	1.86e-04	5.43e-05	1.86e-05	1.29e-05	];

Lev_noise_output = [1.01e-03	9.89e-04	5.13e-04	4.12e-04	4.95e-04	5.50e-04	7.16e-04	8.22e-04	7.67e-04	7.50e-04];

Lev_signal_output=[5.89e-06	1.45e-05	4.37e-05	1.38e-03	2.40e-03	1.04e-03	3.27e-05	8.04e-06	4.22e-06	2.11e-06];

figure (1)
subplot(2,2,1)
plot(f, Lev_noise_input)
xlabel ('Frequency [Hz]')
ylabel ('Amplitude  [V]')
title('Noise_input')
subplot (2,2,2)
plot(f, Lev_signal_input)
xlabel('Frequency [Hz]')
ylabel('Ambplitude [V]')
title ('Signal_input')
subplot(2,2,3)
plot(f, Lev_noise_output)
xlabel ('Frequency [Hz]')
ylabel ('Amplitude  [V]')
title('Noise_output')
subplot (2,2,4)
plot(f, Lev_signal_output)
xlabel('Frequency [Hz]')
ylabel('Ambplitude [V]')
title ('Signal_output')

%SNR
P_signal = mean(Lev_sygnalu_input.^2);
P_noise = mean(Lev_szumu_input.^2);
SNR = P_signal/P_noise;
SNRdB= 10*log(SNR)

%Bandwith
DC_gain = Lev_sygnalu_output/Lev_sygnalu_input; 
dB_gain = 20*log10(DC_gain) 
dB_drop = max(dB_gain-3) 

figure(2)
semilogx(f, dB_gain, 'sk-')
grid on;
xlabel('Frequency [Hz]');
ylabel('Gain [dB]')
title('Gain / Frequency');

fb = bandwidth(f, dB_drop)

%THD
FFT = abs(fft(Lev_sygnalu)).^2;
power_bin = min( find(FFT==max(FFT)));
signal_power = FFT(power_bin);
d_power = sum( [2 3 4 5 6]*power_bin );
THD = d_power/signal_power
THDdB= 10*log(THD)
 
Last edited by a moderator:

Hi,

SNR means Signal to Noise Ratio.

You need an input signal. It should be high in amplitude, but below clipping level. The frequency should be somewhere in near the center of interrest.
(often with audio signals 1kHz is used)

Then you need to sample a lot of data. Sampling rate should be in integer multiple of your input signal frequency to avoide FFT windowing.
Also sampling rate should be at least twice of the max. frequeny_of_interest (Audio: often max frequency_of_interrest = 20kHz, so use at least 40kHz sampling frequency)

Then you perform an FFT.

from FFT results calculate "signal amplitude" and "noise amplitude"

Then calculate the ratio of both.
Then calculate dB.

Klaus
 

Do you mean I should measure the amplifiers once again? Well, I think I won't be albe to do that for every of them.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top