- Make sure that you are plotting the magnitude spectrum correctly: To plot the magnitude spectrum in MATLAB, you usually need to take the absolute value of the FFT output (assuming you are working with real signals). Double-check that you are using the correct formula for calculating the magnitude spectrum. Further I could see the absolute value step in the mentioned code.
- Check the scaling of the frequency axis: The frequency axis in the spectrum plot may be scaled incorrectly. To fix this, try setting the 'freq' or 'x' axis limits manually using the xlim function.For example, if you want to plot the magnitude spectrum between 0Hz and 10kHz, use the following command:xlim([0 10000]);
- Verify the sampling rate of the input signal: If you are not using the correct sampling rate of the input signal when computing the FFT, the magnitude scale will be off. Make sure you are using the correct sampling frequency in the FFT function.
- Apart from this, please check whether the time domain data's magnitude is somewhat similar to the desired time domain data. The time domain data itself have a mutliplying factor which will directly reflect in the frequency domain. Make sure the time data magnitude is adjusted (normalization can also help sometimes).
Plotting a magnitude frequency graph but getting an incorrect magnitude scale
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
The two attached images show my issue, my graph is seemingly out by a factor of roughly 10^4
example of how magnitude was calculated for one of the 10 data sets:
Yp1t1=fft(point(1).output(1:1000,1))/length(point)
N=length(Yp1t1); % Y should be the FFT of the signal
freqsp1t1 = (0:N/2-1)*(fs/N); % frequency vector
Y_singlep1t1 = [ Yp1t1(1) ; 2*Yp1t1(2:end/2) ];
Yp1t2=fft(point(1).output(1:1000,2))/length(point)
Y_singlep1t2 = [ Yp1t2(1) ; 2*Yp1t2(2:end/2) ];
Yp1t3=fft(point(1).output(1:1000,3))/length(point)
Y_singlep1t3 = [ Yp1t3(1) ; 2*Yp1t3(2:end/2) ];
Yp1t4=fft(point(1).output(1:1000,4))/length(point)
Y_singlep1t4 = [ Yp1t4(1) ; 2*Yp1t4(2:end/2) ];
Yp1t5=fft(point(1).output(1:1000,5))/length(point)
Y_singlep1t5 = [ Yp1t5(1) ; 2*Yp1t5(2:end/2) ];
point1_output = (Y_singlep1t1+Y_singlep1t2+Y_singlep1t3+Y_singlep1t1+Y_singlep1t5)/5
0 Kommentare
Antworten (1)
Gokul Nath S J
am 25 Mai 2023
Hi Zack,
I understand that your magnitude variations are quite large.
Here are a few things to check:
with regards,
Gokul Nath S J
0 Kommentare
Siehe auch
Kategorien
Mehr zu Fourier Analysis and Filtering finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!