1.Matlab code to generate sum of sinusoidal signals
Title('sum of sine waves');
t=0:0.5:2*pi;
y=sin(t);
subplot(4,2,1)
stem(y)
xlabel('n');
ylabel('amplitude');
title('sinewave');
subplot(4,2,2);
plot(y);
xlabel('n');
ylabel('amplitude');
title('sinewave');
y1=sin(t)+5*sin(2*t);
subplot(4,2,3);
xlabel('n');
ylabel('amplitude');
title('sinewave with harmonics');
subplot(4,2,4);
stem(y1);
xlabel('n');
ylabel('amplitude');
title('sinewave with harmonics');
y2=sin(t)+5*sin(2*t)+10*sin(3*t);
subplot(4,2,5);
stem(y2);
xlabel('n');
ylabel('amplitude');
title('sinewave with two harmonics');
subplot(4,2,6);
plot(y2);
xlabel('n');
ylabel('amplitude');
title('sine wave with two harmonics');
y3=sin(t)+5*sin(2*t)+10*sin(3*t)+15*sin(4*t);
subplot(4,2,7);
stem(y3);
xlabel('n');
ylabel('amplitude');
title('sinewave with three harmonics');
subplot(4,2,8);
plot(y3);
xlabel('n');
ylabel('amplitude');
2.Matlab Program to verify Linear Convolution
x=input('Enter Input Sequence:');
y=input('Enter Impulse Response:');
y=conv(x,h);
subplot(3,1,1);
stem(x);
ylabel('amplitude');
xlabel('a');
title('input signal');
subplot(3,1,2);
stem(h);
ylabel('amplitude');
xlabel('b');
title('Impulse Response');
subplot(3,1,3);
stem(y);
ylabel('amplitude');
xlabel('c');
title('Linear Convolution');
disp('The Resultant Signal is:');
disp(y)
3.Matlab Program to find N-Point fft of a sequence
x=input('Enter the Sequence:');
n=input('Enter the Length of FFT:');
y=fft(x,n);
subplot(2,1,1);
stem(x);
title('Input Sequence');
xlabel('time index n');
ylabel('Amplitude');
subplot(2,1,2);
stem(y);
title('output sequence');
xlabel('frequency index');
ylabel('amplitude');
with regards,
B V K
No comments:
Post a Comment