FFT and IFFT: Random Phases

P
pro_vided · Dec 24, 2021 · 2K views
Question
I imported a single audio file to MATLAB workspace.   After I apply the FFT:     How can I random change the audio phases before apply the Inverse FFT and get the 'new_signal'? new_signal = ifft(Y) How can I do it?
Expert Answer
Profile picture of Neeta Dsouza
Neeta Dsouza PhD Expert
Answered Aug 29, 2026

here is what I used to randomize an array of timeseries data:

 

function randX = phaseRandomize(X)
% Returns a phase-randomized version of the input data X. If X is an array,
% each row is treated as an independant time series, and columns represent
% sample points. 

[N,L]=size(X);
Y=fft(X,[],2); % Get spectrum

% Add random phase shifts (negative for conjugates), preserve DC offset
rnd_theta= -pi + (2*pi).*rand(N,L/2-1); 
Y(:,2:L/2)=Y(:,2:L/2).*exp(1i*rnd_theta);
Y(:,L/2+2:L)=Y(:,L/2+2:L).*exp(-1i*flip(rnd_theta,2));

% return phase-randomized data
randX =ifft(Y,[],2);
end

 

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!