How to get a the Frequency responce of a System by using the FFTs of the in- and output?

6 vues (au cours des 30 derniers jours)
Hello, I need help for a project I'm working on. From the mesurments I got a time vector and 2 vectors with data. The first is represents the stimulation on the system with an impuls hammer (Input) and the other one represents the measurments from an acceleration sensor. I exportet the Data from Excel and I already made the FFTs to get a Frequency Domain.
Fs=10000; %Sampling frequenzy
Ts=1/Fs; %Sampling time
dt=t(2)-t(1);
%%%%%%%%%%%%%%%- Sensor - %%%%%%%%%%%%%%%%%%%%%%
L=length(bs); %Length of Signal
df=Fs/L;
NFFT_bs=2^nextpow2(L);
FFT_bs=fft(bs,NFFT_bs)/L; %FFT
f=Fs/2*linspace(0,1,NFFT_bs/2+1);
figure(1);
subplot(2,1,1);
plot(t,bs);
xlim ([0 max(t)]);
xlabel('Time [s]');
ylabel('Beschleunigung [mm/s²]');
grid on;
subplot(2,1,2);
semilogy(f,2*abs(FFT_bs(1:NFFT_bs/2+1)));
ylim manual;
xlabel('Frequence [Hz]');
ylabel('Amplitude [dB]');
%close(figure(1));
%%%%%%%%%%%%%%%- Force - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
N=length(F); %Length of Signal
df=Fs/N;
NFFT_F=2^nextpow2(N);
FFT_F=fft(F,NFFT_F)/N; %FFT
f=Fs/2*linspace(0,1,NFFT_F/2+1);
figure(2);
subplot(2,1,1);
plot(t,F);
xlim ([0 max(t)]);
xlabel('Time [s]');
ylabel('Kraft [N]');
grid on;
subplot(2,1,2);
semilogy(f,2*abs(FFT_F(1:NFFT_F/2+1)));
ylim manual;
xlabel('Frequence [Hz]');
ylabel('Amplitude [dB]');
grid on;
%close(figure(2));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FFT_G=FFT_bs/FFT_F;
Now I want to plot the Frequency responce of the System. In the last line I tried to divide the output by the Input, but it didn't work... it just showed me this :
Error using \ Requested 131072x131072 (256.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information.
I don't know what to do. Does anyone know what I should do ? Thx a lot :)

Réponse acceptée

Star Strider
Star Strider le 10 Juin 2017
The short answer is that you need to do element-wise division here:
FFT_G = FFT_bs ./ FFT_F;
↑ ← INSERT ‘.’ HERE
See the documentation on Array vs. Matrix Operations (link) for a full explanation.
IF you want to model the system that created your data, do system identification.
You can use the System Identification Toolbox functions iddata and tfest to do what you want.
The Signal Processing Toolbox has the invfreqz function that will do essentially the same thing.
The results from the two Toolbox functions are not directly compatible with each other. You have to write your own code to use the results of one Toolbox with the functions of the other.
See the documentation for the individual functions to understand how to use them with your data.
  4 commentaires
Linda Yakoubi
Linda Yakoubi le 14 Juin 2017
Modifié(e) : Linda Yakoubi le 14 Juin 2017
Maybe you can helpt me again.. I now tried to plot the last Signal
FFT_G=FFT_bs./FFT_F;
figure(3);
loglog(f,(2*abs(A1(1:NFFT_bs/2+1))));
I used nFFT_bs because it's the same size. To check if this algorithm does what it's supposed to do I tried get a Sinus Signal using Simulink and as PT1-System/Transfer fct, what will be my "FFT_G" (see picture). So I know how the result looks like. But I don't get it right... Can you see where my error is ?
Star Strider
Star Strider le 14 Juin 2017
I cannot. I have not used Simulink for many years.
I do not know what the size of ‘f’ or ‘A1’ are, or what your error is.
This is a guess:
loglog(f(1:fix(length(NFFT_bs)/2)+1), 2*abs(A1(1:fix(length(NFFT_bs)/2)+1))));
See if that works.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Plot Customization dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by