not able to calculate convolution sum properly without convolution command
Mostrar comentarios más antiguos
not able to calculate convolution sum properly. i have writen the following code but it is giving me wrong answer. close all clear all step=0.001 th=0:step:10 th1=0:step:1 th2=1:step:2 th3=2:step:10 th=[th1 th2 th3] x1=zeros(size(th1)) x2=ones(size(th2)) x3=zeros(size(th3)) x=[x1 x2 x3] step=0.001 m=0:step:10 m1=0:step:1 m2=1:step:2 m3=2:step:10 m=[m1 m2 m3] y1=zeros(size(m1)) y2=ones(size(m2)) y3=zeros(size(m3)) z=[y1 y2 y3] t=-1 subplot(6,1,1) plot(th,x,-m+t,z,'r') legend('x(\tau)','h(t-\tau)'); t=2.5 subplot(6,1,2) plot(th,x,-m+t,z,'r') legend('x(\tau)','h(t-\tau)'); t=3 subplot(6,1,3) plot(th,x,-m+t,z,'r') legend('x(\tau)','h(t-\tau)'); t=3.5 subplot(6,1,4) plot(th,x,-m+t,z,'r') legend('x(\tau)','h(t-\tau)'); t=4.5 subplot(6,1,5) plot(th,x,-m+t,z,'r') legend('x(\tau)','h(t-\tau)'); syms t r f=1; j1=int(f,r,1,t-1) j2=int(f,r,1,2) j3=int(f,r,t-2,2) j=[j1 j2 j3] b1=2:0.1:3 b2=3 b3=3:0.1:4
y1=b1-2 y2=1*ones(size(b2)) y3=4-b3
subplot(6,1,6) plot(b1,y1,b2,y2,b3,y3,'g')

2 comentarios
irtaza anwar
el 23 de Abr. de 2015
Image Analyst
el 23 de Abr. de 2015
Try using the 'same' option of conv().
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Particle & Nuclear Physics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!