# How to take the engineering FFT (magnitude spectrum scaled correctly) of Signal in Matlab?

16 ビュー (過去 30 日間)
farzad 2020 年 11 月 29 日
コメント済み: farzad 2020 年 11 月 30 日
Hi All
the fft function in matlab gives a theoretical mathematical fft of the signal, and is not scaled to units and is real immaginary and not amplitude-frequency
I think in better terms, I want to plot the amplitude spectrum of the signal,, with the X axis being the frequencies of the input signal.
is there an alternative way of fft to do this ? and is the following link correct?
for example if this is my signal
using the code in the link I get
which its extremums do not meet the extremums of the time signal
##### 8 件のコメント表示非表示 7 件の古いコメント
farzad 2020 年 11 月 30 日
It was not possible to attach the signal file here I dont know why. It is an xlsx file of 2.8 MB. but does not get attached. I will add the code to the question as well. I have tried both of these. you can generate a random signal and check with it. my problem is not the signal
function [frq, amp] = simpleFFT(signal)
n = length(signal);
%generate the vector of frequencies
halfn = floor(n / 2)+1;
deltaf = 1 / ( n / ScanRate);
frq = (0:(halfn-1)) * deltaf;
z = fft(signal, n); %do the actual work
x=signal(:,1);
xFFT = abs(fft(x))/length(x);
amp = abs(fft(x).^2);
end
function [frq, amp] = simpleFFT(signal,ScanRate)
N=length(signal);
N1=2^nextpow2(N);
X=fft(signal,N1);
X_mag=abs(X); %Magnitude Spectrum
X_phase=phase(X); %Phase Spectrum
frq=ScanRate*(0:N1/2-1)/N1; %Frequency axis
amp= X_mag/N1;
end

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

### 回答 (1 件)

Walter Roberson 2020 年 11 月 30 日
The unit for the y axis of the discrete fft is the original unit per hertz. You need to integrate it over frequency to get the original unit.
##### 1 件のコメント表示非表示 なし
farzad 2020 年 11 月 30 日
Thank you , so if I integrate, what will I have ? still a magnitude spectrum ?

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

### カテゴリ

Find more on Spectral Measurements in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by