[Scilab-users] shift phase in fft

paul.carrico at free.fr paul.carrico at free.fr
Thu Sep 29 12:29:02 CEST 2016


Dear all 


I'm sorry about asking a so basic question, but I do not understand how to make a shift phase in a fft ; There's something I do not catch what ? 


Regards 


Paul 




###################################################### 

mode(0) 
clear all 


f = 10; // frequency 
omega = 2*%pi*f; // circular frequency 
nb_T = 5; // number of periods 
t1 = 0; 
t2 = (nb_T / f); 
n = 10; 
t = linspace(t1,t2,2^n)'; // must be a power of 2 
nl = size(t,"*"); 


s1 = 2*sin(omega*t); // original signal 
plot(t,s1,"r"); 


phi = %pi/3; 
s2 = 2*sin(omega*t + phi); // targetted signal to be rebuilt 
plot(t,s2,"b"); 


// shift phase in the fft 
s1_fft = fft(s1); 
s1_fft = clean(s1_fft); 

//s1_fft = s1_fft. * exp(-%i*phi/nl); 
s1_fft = s1_fft. * exp(-%i*phi); 
s1_new = ifft(s1_fft); 
plot(t,s1_new,"g"); 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20160929/7f365b1d/attachment.htm>


More information about the users mailing list