Code:
clc;
clear
all;
g=input('Type
in the first sequence:');
h=input('Type
in the second sequence:');
ga=[g
zeros(1,length(h)-1)];
ha=[h
zeros(1,length(g)-1)];
G=fft(ga);
H=fft(ha);
Y=G.*H;
y=ifft(Y);
subplot
411; stem(g); title('First sequence');
subplot
412; stem(h); title('second sequence');
subplot
413; stem(y); title('New sequence');
subplot
414; plot(y); title('New sequence');
Output:
Type in the first sequence:[1 2 5]
Type in the second sequence:[ 6 7 8]
0 comments:
Post a Comment