You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.1KB

  1. for i = 1:5e6:15e6
  2. fg.write_unsafe(['apply:sin ', num2str(i)])
  3. fg.opc
  4. fg.write_unsafe('func:shape ramp')
  5. fg.opc
  6. end
  7. fg.error
  8. %%
  9. % plot y=11*exp(-|x/6|)*sin(x) from x= -12.5 to x=9.4
  10. x = linspace(-10*pi,10*pi,8000);
  11. y = 11.*exp(-abs(x./6)).*sin(x);
  12. plot(x,y,x+20*pi,y)
  13. %%
  14. tic
  15. fg.frequency = 2000;
  16. fg.waveform = 'sinus';
  17. fg.unit = 'Vrms';
  18. fg.frequency = 1e6;
  19. toc
  20. %%
  21. a=-10*log(1+(2*pi*f*r*c)^2);
  22. s=step(2*pi*f-1/(r*c))*(-20*log(2*pi*f*r*c));
  23. p=-atan(2*pi*f*r*c);
  24. %%
  25. f1=100;
  26. phase_diff1 = 0.5;
  27. tp=((1:1000)./1000);
  28. tp2=tp-((phase_diff1*1000/(f1*360))./1000);
  29. % normalizing - 360 is 1 complete phase shift
  30. x=0.8*exp(2*pi*i*signal_freq*tp)+0.4*exp(2*pi*i*20*tp);
  31. y=0.8*exp(2*pi*i*signal_freq*tp2)+0.4*exp(2*pi*i*20*tp);
  32. %%
  33. Fs = (wave1.stop-wave1.start)/wave1.length;
  34. p1=(fft(real(wave1.waveform),1024));
  35. p2=(fft(real(wave2.waveform),1024));
  36. phase_diff=(angle(p1(f1)))-(angle(p2(f1)));
  37. %%
  38. tic
  39. [data,raw] = transferFunction(sc,fg,500,5000,50,10);
  40. figure;
  41. subplot(2,1,1)
  42. semilogx(data.frequency,data.magnitude)
  43. subplot(2,1,2)
  44. semilogx(data.frequency,data.phase);
  45. toc