4. COMPLEX FUNCTION

COMPLEX FUNCTION
clear;
figure;
a=input('Type in the real constant:');
b=input('Type in the imaginary constant:');
c=a+(b*i);
K=input('Type in the gain constant:');
N=input('Type in the length of the sequence:');
n=1:2:N-1;
mag=sin(K.^2)*exp(-c*n);
stem(n-1,real(mag));
xlabel=('No. of samples');
ylabel=('Magnitude of REAL part');
title=('Real Plot');
pause;
stem(n-1,imag(mag));
xlabel=('No. of samples');
ylabel=('Magnitude of IMAGINARY part');

title=('Imaginary Plot');

RESULT

Type in the real constant:                           .1
Type in the imaginary constant :                .1    
Type in the gain constant:                            1
Type in the length of the sequence:        50

matlab

No comments:

Post a Comment