Thanks Rafael (and Antoine as well) 

Now I think I understand what went wrong 

Paul 
----- Mail original -----

De: "Rafael Guerra" <jrafaelbgue...@hotmail.com> 
À: "Users mailing list for Scilab" <users@lists.scilab.org> 
Envoyé: Jeudi 29 Septembre 2016 13:38:09 
Objet: Re: [Scilab-users] shift phase in fft 



Hi Paul, 

Your phase rotation seems to be working fine but the fft output is complex and 
only the real part is plotted by Scilab and that is why the resulting amplitude 
seems to be smaller. 

If you want to have your output real, one way is may be to handle separately 
the positive and negative frequencies as follows: 
clf () ; 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 ( 1 : nl / 2 ) = 
s1_fft ( 1 : nl / 2 ) .* exp ( % i * phi ) ; s1_fft ( nl / 2 :$ ) = s1_fft ( nl 
/ 2 :$ ) .* exp ( - % i * phi ) ; s1_new = ifft ( s1_fft ) ; plot ( t,s1_new, 
"--g" ) ; 


Regards, 
Rafael 





_______________________________________________ 
users mailing list 
users@lists.scilab.org 
http://lists.scilab.org/mailman/listinfo/users 

_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to