How can i know the best sampling rate to use in a ADC using Fourier

1 view (last 30 days)
I want to analize a a biphasic truncated exponential wave, so i generated the wave in matlab
t1=0:0.0001:0.0025;
VS= 5000;
R1=25;
C1=90*10^(-6);
func1= VS*exp(-t1/(R1*C1))/R1;
plot (t1,func1), grid, xlim ([0 0.01])
t2=0:0.0001:0.0015;
VS= 5000;
R1=25;
C2=90*10^(-6);
func2=(-VS*exp(-t2/(R1*C2))/R1);
plot (t2,func2),xlim ([0 0.01]), grid
t=0:0.0001:0.008;
t0=0:0.0001:0.0038;
zero=t0*0;
final= [func1 func2 zero];
plot (t,final),xlim ([0 0.01]), grid
Now i want to use the FFT but i don't know how to use it because it's for a discrete waveform.
Doing some research i found a code and i modified it a bit to this problem:
fourier=fft (final);
L= length(t)
P2 = abs(fourier/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
Fs=25000
f = Fs*(0:(L/2))/L;
plot(f,P1)
grid
title('Single-Sided Amplitude Spectrum of X(t)')
xlabel('f (Hz)')
ylabel('|P1(f)|')
I get a razonable plot, but the problem is that i dont know wich sample rate (Fs) should i use, because if i switch this value the values of the max frequencies change too, so i'm not able to choose an adc sampling rate
Thanks

Accepted Answer

Mathieu NOE
Mathieu NOE on 25 Oct 2021
hello
Fs is the inverse of the time increment dt
clc; clear all; close all;
dt = 0.0001;
t1=0:dt:0.0025;
VS= 5000;
R1=25;
C1=90*10^(-6);
func1= VS*exp(-t1/(R1*C1))/R1;
% plot (t1,func1), grid, xlim ([0 0.01])
t2=0:dt:0.0015;
VS= 5000;
R1=25;
C2=90*10^(-6);
func2=(-VS*exp(-t2/(R1*C2))/R1);
% plot (t2,func2),xlim ([0 0.01]), grid
t =0:dt:0.008;
t0=0:dt:0.0038;
zero=t0*0;
final= [func1 func2 zero];
plot (t,final),xlim ([0 0.01]), grid
fourier=fft (final);
L= length(t)
P2 = abs(fourier/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
Fs=1/dt;
f = Fs*(0:(L/2))/L;
plot(f,P1)
grid
title('Single-Sided Amplitude Spectrum of X(t)')
xlabel('f (Hz)')
ylabel('|P1(f)|')

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!