Overview of Convolution Integral Topics
- Impulse response defined
- Several derivations of the convolution integral
- Relationship to circuits and LTI systems
- J. McNames
Portland State University ECE 222 Convolution Integral
- Ver. 1.68
Overview of Convolution Integral Topics Impulse response defined - - PowerPoint PPT Presentation
Overview of Convolution Integral Topics Impulse response defined Several derivations of the convolution integral Relationship to circuits and LTI systems J. McNames Portland State University ECE 222 Convolution Integral Ver. 1.68 1
t RC u(t)
t = -2:0.001:10; tc = [0 2 5]; for c1 = 1:length(tc), subplot(length(tc),2,c1*2-1); h = plot(tc(c1)*[1 1],[0 1],’b’,tc(c1),0.95,’b^’); set(h,’MarkerFaceColor’,’b’); set(h,’MarkerSize’,3); st = sprintf(’x_%d(t) = \\delta(t-%d)’,c1,tc(c1)); disp(st) ylabel(st); box off; xlim([min(t) max(t)]); ylim([0 1]); subplot(length(tc),2,c1*2); y1 = exp(-(t-tc(c1))).*(t>=tc(c1)); % Unit impulse response h[n] h = plot(t,y1,’r’); st = sprintf(’y_%d(t) = h(t-%d)’,c1,tc(c1)); ylabel(st); box off; xlim([min(t) max(t)]); end;
fs = 1000; t0 = -0.5; t1 = 2.5; h = [0.50 0.25 0.10 0.04]; subplot(length(h)+1,1,1); t = t0:1/fs:t1; x = t.*(t>=0&t<1) + (-(t-2)).*(t>=1&t<2); hp = plot(t,x); set(hp,’MarkerFaceColor’,’b’); set(hp,’MarkerSize’,3); title(’Input’); ylabel(’x(t)’); box off; xlim([t0 t1]); for c1 = 1:length(h), subplot(length(h)+1,1,c1+1); t = t0:h(c1):t1; x = t.*(t>=0&t<1) + (-(t-2)).*(t>=1&t<2); hp = bar(t,x,1); set(hp,’FaceColor’,’w’); set(hp,’EdgeColor’,’r’); st = sprintf(’w = %4.2f’,h(c1)); ylabel(st); box off; xlim([t0 t1]); end;
sys = tf([0 1],[1 1]); % Transfer function of an RC circuit with RC = 1 t = -2:0.001:10; ht = exp(-t).*(t>=0); % System impulse response h = [2.0 1.0 0.1]; for c1 = 1:length(h), subplot(length(h),2,(c1-1)*2+1); x = (t>0 & t<h(c1))/h(c1); plot(t,x); title(’Input’); ylabel(’x(t)’); box off; xlim([min(t) max(t)]); subplot(length(h),2,c1*2); y = lsim(sys,x,t); % Simulate the output of the system plot(t,ht,’g’,t,y,’r’); legend(’h(t)’,’y(t)’); title(’Output’); ylabel(’y(t)’); box off; xlim([min(t) max(t)]); end;
fs = 1000; t0 = -0.5; t1 = 2.5; t = t0:1/fs:t1; x = t.*(t>=0&t<1) + (-(t-2)).*(t>=1&t<2); h = [0.5,0.25,0.10,0.04]; for c1 = 1:length(h), subplot(length(h),2,c1*2-1); th = t0:h(c1):t1; xr = th.*(th>=0&th<1) + (-(th-2)).*(th>=1&th<2); hb = bar(th,xr,1); set(hb,’FaceColor’,’w’); set(hb,’EdgeColor’,’b’); hold on; plot(t,x,’g’); hold off; st = sprintf(’w = %4.2f’,h(c1)); ylabel(st); box off; xlim([t0 t1]); subplot(length(h),2,c1*2); for c2 = 1:length(th), hp= plot(th(c2)*[1 1],[0 xr(c2)]*h(c1),’r’,th(c2),0.95*xr(c2)*h(c1),’r^’); hold on; set(hp(2),’MarkerFaceColor’,’r’); set(hp(2),’MarkerSize’,2); set(hp(2),’LineWidth’,0.001); end; hold off; box off; ylim([0 h(c1)]); xlim([t0 t1]); end;
sys = tf([0 1],[1 1]); % Transfer function of an RC circuit with RC = 1 t0 = -2; t1 = 10; t = t0:0.001:t1; xt = t.*(t>=0&t<1) + (-(t-2)).*(t>=1&t<2); % True system input yt = lsim(sys,xt,t); % Simulate the output of the system y = zeros(size(t)); h = 0.5; ti = [0.5 1.0 1.5]; % Impulse times xi = [0.5 1.0 0.5]*h; % Impulse Amplitudes for c1 = 1:length(ti), subplot(length(ti)+1,2,c1*2-1); hp= plot(ti(c1)*[1 1],[0 xi(c1)],’b’,ti(c1),0.95*xi(c1),’b^’); set(hp,’MarkerFaceColor’,’b’); set(hp,’MarkerSize’,2); set(hp,’LineWidth’,0.001); box off; ylim([0 max(xi)]); xlim([min(t) max(t)]); subplot(length(ti)+1,2,c1*2); yp = xi(c1)*exp(-(t-ti(c1))).*((t-ti(c1))>=0); % Response to a single impulse plot(t,yp,’r’); box off; ylim([0 0.66]); xlim([min(t) max(t)]); y = y + yp; % Total Response end;
subplot(length(ti)+1,2,length(ti)*2+1); for c1 = 1:length(ti), hp = plot(ti(c1)*[1 1],[0 xi(c1)]*h,’b’,ti(c1),0.95*xi(c1)*h,’b^’); set(hp,’MarkerFaceColor’,’b’); set(hp,’MarkerSize’,2); set(hp,’LineWidth’,0.001); hold on; end; hold off; box off; ylim([0 max(xi)*h]); xlim([min(t) max(t)]); xlabel(’Time (s)’); subplot(length(ti)+1,2,length(ti)*2+2); plot(t,yt,’g’,t,y,’r’); box off; ylim([0 0.66]); xlim([min(t) max(t)]); xlabel(’Time (s)’); legend(’True’,’Approximate’);
sys = tf([0 1],[1 1]); % Transfer function of an RC circuit with RC = 1 t0 = -2; t1 = 10; t = t0:0.001:t1; x = t.*(t>=0&t<1) + (-(t-2)).*(t>=1&t<2); % True system input yt = lsim(sys,x,t); % Simulate the output of the system h = [0.50 0.25 0.10]; for c1 = 1:length(h), subplot(length(h),2,c1*2-1); th = t0:h(c1):t1; % Impulse times xr = th.*(th>=0&th<1) + (-(th-2)).*(th>=1&th<2); % Impulse amplitudes for c2 = 1:length(th), hp= plot(th(c2)*[1 1],[0 xr(c2)]*h(c1),’b’,th(c2),xr(c2)*h(c1),’b^’); hold on; set(hp,’MarkerFaceColor’,’b’); set(hp,’MarkerSize’,1.2); set(hp(1),’LineWidth’,0.3); set(hp(2),’LineWidth’,0.001); end; hold off; box off; subplot(length(h),2,c1*2); y = zeros(size(t)); for c2 = 1:length(th), y = y + h(c1)*xr(c2)*exp(-(t-th(c2))).*((t-th(c2))>=0); end; hp = plot(t,yt,’g’,t,y,’r’); set(hp(1),’LineWidth’,0.8); set(hp(2),’LineWidth’,0.3); legend(’True’,’Approximate’); box off; end;