Advertisement
neo01124

test_genspecsines

Nov 7th, 2011
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.57 KB | None | 0 0
  1. N=1024;
  2. f1=10.3;
  3. f2=20.6;
  4. f3=30.9;
  5. a1=-10;
  6. a2=-13;
  7. a3=-16;
  8. w=blackmanharris(1024)/sum(blackmanharris(1024));
  9. y=genspecsines([f1, f2, f3], [a1,a2,a3], [0,0,0], N);
  10. t=[-511:1:512];
  11. my=real(ifft(y));
  12. y1=zeros(N,1);
  13. y1=fftshift(my);
  14. %y1(1:N/2)=(my(N/2+1:N));
  15. %y1(N/2+1:N)=(my(1:N/2));
  16. %A1=(1/10*(10^((abs(a1))/20)));
  17. %A2=(1/10*(10^((abs(a2))/20)));
  18. %A3=(1/10*(10^((abs(a3))/20)));
  19. clf;
  20. plot(y1);
  21. subplot(2,1,1);
  22. plot(y1./w);
  23. subplot(2,1,2);
  24. plot(-a1*cos(2*pi*f1*t/1024)-a2*cos(2*pi*f2*t/1024)-a3*cos(2*pi*f3*t/1024), 'r');%+cos(2*pi*1.5*f*t/1024)+cos(2*pi*2*f*t/1024));
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement