フィルターのクリア

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

1 回表示 (過去 30 日間)
Jose Francisco Actis Danna
Jose Francisco Actis Danna 2021 年 10 月 22 日
コメント済み: Mathieu NOE 2021 年 10 月 25 日
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

採用された回答

Mathieu NOE
Mathieu NOE 2021 年 10 月 25 日
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)|')
  2 件のコメント
Jose Francisco Actis Danna
Jose Francisco Actis Danna 2021 年 10 月 25 日
Thanks a lot!! that's what i was looking for!
regards Mathieu
Mathieu NOE
Mathieu NOE 2021 年 10 月 25 日
My pleasure !

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by