Skip to content

Instantly share code, notes, and snippets.

@semihozkoroglu
Created March 24, 2011 21:00
Show Gist options
  • Save semihozkoroglu/885874 to your computer and use it in GitHub Desktop.
Save semihozkoroglu/885874 to your computer and use it in GitHub Desktop.
Verilen ayrık sinyallerin çarpımı.
h = [1, 2, 3, 4, 5, 4, 3, 2 ,1];
x = [0, 10, 10, 10, 10, 10, 10, 10, 0];
subplot(3,1,1); plot(h);
subplot(3,1,2); plot(x);
p = [];
i = 0;
durum = 0;
for k = 1:(length(h)+length(x)-1)
top = 0;
if ( durum == 1)
t -= 1;
s = length(x);
for z = t:-1:1
top += h(z)*x(s);
s -= 1;
end
p(k) = top
end
if ( durum == 0)
t = length(h);
i += 1;
for s = i:-1:1
top += h(t)*x(s);
t -= 1;
if ( t == 0 )
durum = 1;
t = length(h);
end
end
p(k) = top
end
subplot(3,1,3); plot(p);
sleep(2)
end
sleep(5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment