Advertisement
iuliaa

l4

Mar 11th, 2021
889
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.57 KB | None | 0 0
  1. function []=lab4(input,output,amp, freq)
  2. info=audioinfo(input);
  3. [y,fs]=audioread(input);
  4. % step=1/fs;
  5. % duration=info.Duration;
  6. % t=0:step:duration;
  7. % time=t(1:end-1);
  8. % transposed_time=transpose(time);
  9. subplot(3,1,1);
  10. plot(y(1:1000));
  11. title('input');
  12. fm=freq/fs;
  13. arg=2*pi*fm;
  14.  for i=1:length(y)
  15.      modulator(i)=(1+amp*sin(arg*i));
  16.      y_out(i)=modulator(i)*y(i);
  17.      %y(i)=(1+amp*sin(arg*i))*y(i);
  18.  end
  19. subplot(3,1,2);
  20. plot(modulator(1:1000));
  21. title('modulator');
  22. subplot(3,1,3);
  23. plot(y_out(1:1000));
  24. title('output');
  25. audiowrite(output,y_out,fs);
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement