Frequenzantwort mit FFT in MATLAB

Hier ist das Szenario: Mit einem Spektrumanalysator habe ich die Eingabewerte und die Ausgabewerte. die Anzahl der Proben ist32000 und die Abtastrate ist2000 samples / sec, und der Eingang ist eine Sinuswelle von50 hz, der Eingang ist Strom und der Ausgang ist Druck in psi.

Wie berechne ich den Frequenzgang aus diesen Daten mit MATLAB unter Verwendung der FFT-Funktion in MATLAB?

i konnte eine Sinuswelle erzeugen, die den Betrag und die Phasenwinkel ausgibt. Hier ist der Code, den ich verwendet habe:

%FFT Analysis to calculate the frequency response for the raw data
%The FFT allows you to efficiently estimate component frequencies in data from a discrete set of values sampled at a fixed rate

% Sampling frequency(Hz)
Fs = 2000;   

% Time vector of 16 second
t = 0:1/Fs:16-1;   

% Create a sine wave of 50 Hz.
x = sin(2*pi*t*50);                                                       

% Use next highest power of 2 greater than or equal to length(x) to calculate FFT.
nfft = pow2(nextpow2(length(x))) 

% Take fft, padding with zeros so that length(fftx) is equal to nfft 
fftx = fft(x,nfft); 

% Calculate the number of unique points
NumUniquePts = ceil((nfft+1)/2); 

% FFT is symmetric, throw away second half 
fftx = fftx(1:NumUniquePts); 

% Take the magnitude of fft of x and scale the fft so that it is not a function of the length of x
mx = abs(fftx)/length(x); 

% Take the square of the magnitude of fft of x. 
mx = mx.^2; 

% Since we dropped half the FFT, we multiply mx by 2 to keep the same energy.
% The DC component and Nyquist component, if it exists, are unique and should not be multiplied by 2.

if rem(nfft, 2) % odd nfft excludes Nyquist point
  mx(2:end) = mx(2:end)*2;
else
  mx(2:end -1) = mx(2:end -1)*2;
end

% This is an evenly spaced frequency vector with NumUniquePts points. 
f = (0:NumUniquePts-1)*Fs/nfft; 

% Generate the plot, title and labels. 
subplot(211),plot(f,mx); 
title('Power Spectrum of a 50Hz Sine Wave'); 
xlabel('Frequency (Hz)'); 
ylabel('Power'); 

% returns the phase angles, in radians, for each element of complex array fftx
phase = unwrap(angle(fftx));
PHA = phase*180/pi;
subplot(212),plot(f,PHA),title('frequency response');
xlabel('Frequency (Hz)')
ylabel('Phase (Degrees)')
grid on

i nahm den Frequenzgang aus dem Phasendiagramm bei90 Grad Phasenwinkel, ist dies der richtige Weg, um den Frequenzgang zu berechnen?

wie vergleiche ich diese Antwort mit den Werten, die vom Analysegerät erhalten werden? Dies ist eine Gegenprüfung, um festzustellen, ob die Analysatorlogik sinnvoll ist oder nicht.

Antworten auf die Frage(4)

Ihre Antwort auf die Frage