not able to calculate convolution sum properly without convolution command
Mostra commenti meno recenti
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 Commenti
irtaza anwar
il 23 Apr 2015
Image Analyst
il 23 Apr 2015
Try using the 'same' option of conv().
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Particle & Nuclear Physics in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!