I am working on some signals project and all I want to do is apply the fourier transform on a signal, get magnitude and phases and then change the phase matrix to something else say phasenew and then get the signal from magnitude and phasenew.
I am basing my code on Getting Fourier Transform from Phase and Magnitude - Matlab
>> F = fft(x);
>> mag = abs(F);
>> phase = angle(F);
% Calculate phasenew using some algorithm, phasenew is very similar to phase, so output should be same.
>> re = mag .* cos(phasenew);
>> im = mag .* sin(phasenew);
>> F_i = complex(re,im);
>> x_i = ifft(F_i);
The output signal x_i is very different.
I found the similar problem here also : Fourier Transform: getting mag + phase then using those to plot original signal but in this link, I commented on the answer to ask @David about how should I proceed to solve the case of phasenew. He suggested me to ask this as a new question so here it is.
Please help me to generate the signal using inverse fourier transform from original magnitudes and new phases. Thanks in advance.
P.S. In phasenew I just shift the phase by either π/2 or -π/2.