Phase shift in in FFT Harmonics results

1 view (last 30 days)
Dom
Dom on 12 Feb 2022
Answered: Pratyush Swain on 20 Mar 2025
Hi Guys,
I am using the fft_powerscope function to evalute a simulink output signal. My problem is, that the recreated signal does not ressemble the original signal. There seems to be a phase shift somewhere. Can you help me find the error? I shared all the data that I used.
order= z_46.fft_iabc.freq./z_46.fft_iabc.fundamental;
phase= z_46.fft_iabc.phase;
for y=1:length(phase)
phase2(y,1)=phase(y)-phase(2)*(y-1);
end
fs = 1000;
Ts = 1/fs;
duration = 10;
t = 0 : Ts : duration-Ts;
mag= z_46.fft_iabc.mag./ z_46.fft_iabc.magFundamental;
x=mag(1);
M=[order,mag,phase2];
phase=phase*pi/180;
for q=2:length(M)
x=x+mag(q)*sin(2*pi* (q-1)*t+phase(q));
end
Would gladly appreciate your help. The fft start time from the orginal signal is in the data set.

Answers (1)

Pratyush Swain
Pratyush Swain on 20 Mar 2025
Hi Dom,
You can try with following workarounds to correct your signal:
1.Here you are adjusting the phase linearly based on phase(2), which could be distorting the phase across harmonics. This may not be necessary and could be introducing a cumulative shift. Consider using the original phase values directly.
for y=1:length(phase)
phase2(y, 1)=phase(y)-phase(2)*(y-1);
end
2. Consider this revised approach to reconstruct the signal. Use 'order(q)' instead of 'q-1' , the harmonic number might not simply be 'q-1', so try:
x = mag(1);
for q=2:length(M)
x = x + mag(q)*sin(2*pi*order(q)*t + phase(q));
end

Categories

Find more on Fourier Analysis and Filtering 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!