MathScript_example.m
上传用户:sh_ffjj
上传日期:2022-08-05
资源大小:684k
文件大小:0k
源码类别:

LabView编程

开发平台:

LabView

  1. num=2^9;
  2. t=(1:num)/num;
  3. A1=1;
  4. A2=.2;
  5. f1=input('Low Frequency:');
  6. f2=105;
  7. noise_mag=0;
  8. S1=A1*sin(2*pi*f1*t);
  9. S2=A2*sin(2*pi*f2*t);
  10. S=S1+S2;
  11. S=S+noise_mag*(rand(1,length(t))-.5);
  12. filt=fft(S);
  13. filt=abs(filt);
  14. filt=(filt(1:num/2))/(num/2);
  15. f=1:num/2;
  16. subplot(2,1,1);
  17. plot(t,S),title('Simulated Signal');
  18. axis([0,1,-1.5,1.5]);
  19. grid on;
  20. subplot(2,1,2);
  21. plot(f,filt),title('FFT');
  22. axis([0,length(f),0,1.5]);
  23. grid on;