Matlab DSP 실습시간 자료
메이커활동/즐거운공작 2007. 11. 17. 18:22무척 간단하다.
% -------------------- M File Start --------------------
% Impulse Function
% n0, n1, n2
function [x,n] = impseq(n0,n1,n2)
n = [n1:n2];
x = [(n-n0) == 0];
% -------------------- M File End --------------------
% -------------------- M File Start --------------------
% Step FUnction
% n0, n1, n2
% n(from n1 to n2), compare with n0
% if n0
function [x,n] = stepseq(n0,n1,n2)
n = [n1:n2];
x = [(n-n0) >= 0];
% -------------------- M File End --------------------
---------- 기타 다음과 같은 명령어 실습 ----------
n=[0:20];
x1 = n.*(stepseq(0,0,20)-stepseq(10,0,20));
x2 = 10*exp(-0.3*(n-10).*(stepseq(10,0,20)-stepseq(20,0,20)));
x=x1+x2;
%% plot / Graph Command
th=0:0.5:2*pi
x=sin(th)+i*cos(th);
subplot(2,2,4):stem(phase(x));
subplot(2,2,3):stem(abs(x));
subplot(2,2,2):stem(imag(x));
subplot(2,2,1):stem(real(x));