Generate the Complex exponential sequence with MATLAB

Code:
clc;
clear all;
a=input('Type in real exponent : ');
b=input('Type in complex exponent : ');
c=a+b*i;
k=input('Type in the gain constant : ');
N=input('Type in length of sequence : ');
n=1:N;
x=k*exp(c*n);
subplot(2,1,1)
stem(n-1,real(x));
xlabel('time index n');ylabel('amplitude');
title('real part');
subplot(2,1,2)
stem(n-1,imag(x));
xlabel('time index n');ylabel('amplitude');
title('imaginary part');

ourput:

Type in real exponent : -1/12
Type in complex exponent : pi/6
Type in the gain constant : 4
Type in length of sequence : 40
 

0 comments:

Post a Comment