Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- plot_rows = 2;
- plot_cols = 2;
- t = 0:0.001:1500;
- A = 1;
- fc = 30;
- %carrier
- carrier = cos(2*pi*fc*t);
- subplot(plot_rows,plot_cols,1);
- plot(t,carrier);
- xlim([0 20]);
- ylabel('cos(t)');
- xlabel('t');
- title(sprintf('fc = %d',fc))
- %m(t)
- m =cos(pi*2*t);
- subplot(plot_rows,plot_cols,2);
- plot(t,m);
- xlim([0 20]);
- ylabel('m(t)');
- xlabel('t');
- %f_m
- f_m = (A+m).*carrier;
- subplot(plot_rows,plot_cols,3);
- plot(t,f_m);
- xlim([0 20]);
- ylabel('f_m(t)');
- xlabel('t');
- %f_r
- f_r = abs(f_m);
- subplot(plot_rows,plot_cols,4);
- plot(t,f_r);
- xlim([0 20]);
- ylabel('f_r(t)');
- xlabel('t');
- figure;
- first = 25;
- last = 37;
- step = 1;
- cols = 2;
- rows = (last-first)/cols;
- for RC = first:1:last;
- %h
- h = (1/RC).*(exp(-t./RC)).*(t>=0);
- %f_d
- f_d = (ifft(fft(h) .* fft(f_r))) - A;
- subplot(rows,cols,RC-first+1);
- plot(t,f_d - max(f_d)+3);
- xlim([0 20]);
- ylabel('f_d(t)');
- xlabel('t');
- title(sprintf('RC = %d',RC));
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement