차례 제 1 장 MATLAB 연습 ------------------------------------------------------------ 6 1.1 MATLAB에서사용되는기호들 ----------------------------------------------- 1.2 연산자 (operators) -------------------------------------------------------------------- 1.3 MATLAB에서기본적으로사용하는유용한함수및명령어들 ------ 1.4 데이터입, 출력방법 -------------------------------------------------------------- 1.5 명령어흐름제어 ------------------------------------------------------------------- 1.6 그래프그리는방법 --------------------------------------------------------------- 7 13 15 16 17 19 실습 1 -------------------------------------------------------------------------------------- 31 제 2 장디지털신호처리기본개념 ----------------------------------------- 34 2.1 디지털신호처리란? ------------------------------------------------------------ 2.2 디지털신호처리사용분야 --------------------------------------------------- 2.3 신호의분류 ------------------------------------------------------------------------ 2.4 디지털시스템 --------------------------------------------------------------------- 2.5 샘플링정리 ------------------------------------------------------------------------ 2.6 Aliasing ------------------------------------------------------------------------------ 2.7 양자화 (quantization) 와 A/D 변환기 ------------------------------------------- 34 34 35 37 39 40 41 실습 2 -------------------------------------------------------------------------------------- 43 제 3 장디지털신호표현 --------------------------------------------------------- 45 3.1 디지털기본신호표현 --------------------------------------------------------- 45 3.1.1 단위임펄스신호 (Unit Impulse signal) -------------------------- 3.1.2 단위계단신호 (Unit Step signal) --------------------------------- 3.1.3 실수지수신호 (Real exponential signal) ------------------------ 3.1.4 복소지수신호 (Complex exponential signal) ------------------- 3.1.5 랜덤신호 (Random signal) -------------------------------------------- 3.2 임의신호발생기 ----------------------------------------------------------------- 3.3 White Gaussian 잡음발생기 --------------------------------------------------- 3.4 이산신호연산을위한몇가지편리한함수들 --------------------------- 45 47 48 49 50 53 54 56 실습 3 ------------------------------------------------------------------------------------- 59 제 4 장선형시스템 ------------------------------------------------------------------ 67 4.1 이산시스템 (Discrete System) -------------------------------------------------- 4.2 콘볼루션 (Convolution) 과상관 (Correlation) -------------------------------- 67 71
4.2.1 콘볼루션 ------------------------------------------------------------------ 4.2.2 상관 (Correlation) --------------------------------------------------------- 71 78 실습 4 ------------------------------------------------------------------------------------- 82 제 5 장임펄스응답과선형차분방정식 --------------------------------- 86 5.1 임펄스응답 (Impulse Response) ------------------------------------------------ 5.2 간단한몇가지임펄스응답예 ----------------------------------------------- 5.3 선형차분방정식 ----------------------------------------------------------------- 5.4 차분방정식을통하여주파수응답을구하는방법 --------------------- 86 86 88 89 실습 5 ------------------------------------------------------------------------------------- 91 제 6 장 z- 변환 (z-transform) ------------------------------------------------------ 94 6.1 z- 변환의정의 ---------------------------------------------------------------------- 94 6.1.1 DTFT의일반화에의한정의 --------------------------------------- 6.1.2 z-변환의정의 ----------------------------------------------------------- 6.1.3 전달함수에의한정의 ------------------------------------------------ 6.2 극점과영점 ------------------------------------------------------------------------ 6.3 수렴영역 (Region of Convergence : ROC) --------------------------------- 6.4 안정도판별 ------------------------------------------------------------------------ 6.5 z-변환의성질 (property) ---------------------------------------------------------- 6.6 역 Z-변환 (Inverse Z-Transform) ------------------------------------------------ 94 96 97 99 101 105 107 109 실습 6 ------------------------------------------------------------------------------------- 113 제 7 장이산푸리에변환 (Discrete Fourier Transform) -------------- 121 7.1 아날로그주기신호 -------------------------------------------------------------- 7.2 아날로그비주기신호 ----------------------------------------------------------- 7.3 이산시간푸리에변환 (DTFT) ------------------------------------------------- 7.4 이산푸리에변환 (DFT) --------------------------------------------------------- 7.4.1 이산푸리에변환정의 ----------------------------------------------- 7.4.2 푸리에분석의중요성 ------------------------------------------------ 7.5 고밀도 (high-density) 스펙트럼과고분해능 (high-resolution) 스펙트럼 7.6 이산푸리에변환의응용 ------------------------------------------------------ 7.7 고속푸리에변환 (Fast Fourier Transform : FFT) ------------------------ 121 122 122 130 130 133 134 136 139 7.7.1 DIT 방식 ------------------------------------------------------------------ 139
실습 7 ------------------------------------------------------------------------------------- 144 제 8 장디지털필터 H/W 구조 ------------------------------------------------- 155 8.1 디지털필터시스템구성을위한기본소자표현 --------------------- 8.2 FIR 필터구조 --------------------------------------------------------------------- 8.2.1. 직접형 (Direct Form) 구조 -------------------------------------------- 8.2.2 전치형 (Transpose Form) 구조 --------------------------------------- 8.2.3 직렬연결형 (Cascade Form) 구조 ------------------------------------ 155 156 157 157 158 8.3 IIR 필터구조 ----------------------------------------------------------------------- 159 8.3.1 직접형 I(Direct Form I) 구조 --------------------------------------- 8.3.2 직접형 II(Direct Form II) 또는케노닉형 (Canonic Form) 구조 8.3.3 직렬연결형 (Cascade Form) 구조 ------------------------------------ 8.3.4 병렬형 (Parallel Form) 구조 ------------------------------------------- 159 160 161 162 실습 8 ------------------------------------------------------------------------------------- 164 제 9 장 FIR 필터설계 -------------------------------------------------------------- 177 9.1 디지털필터설계단계 ----------------------------------------------------------- 177 9.1.1 디지털필터의사양결정 -------------------------------------------- 9.1.2 FIR 필터나 IIR 필터의결정 ---------------------------------------- 178 180 9.2 FIR 필터설계 --------------------------------------------------------------------- 181 9.2.1 주파수샘플링법 -------------------------------------------------------- 9.2.2 창함수법 ----------------------------------------------------------------- 9.2.3 등리플필터를위한최적근사화법 ------------------------------ 181 183 187 실습 9 ------------------------------------------------------------------------------------- 190 제 10 장 IIR 필터설계 ------------------------------------------------------------- 204 10.1 아날로그필터설계 ------------------------------------------------------------ 10.2 아나로그필터에서디지털필터로의변환방법 ----------------------- 10.2.1 임펄스불변변환 (impulse invariance transformation) -------- 10.2.2 쌍일차변환 (bilinear transformation) 법 --------------------------- 10.2.3 주파수대역변환 ----------------------------------------------------- 205 212 212 214 215 실습 10 ----------------------------------------------------------------------------------- 217 제 11 장적응필터 (Adaptive Filter) ------------------------------------------- 238
실습 11 ----------------------------------------------------------------------------------- 241 제 12 장디지털신호처리응용 1 --------------------------------------------- 247 과제 1 ------------------------------------------------------------------------------------- 247 제 13 장디지털신호처리응용 2 --------------------------------------------- 250 과제 2 ------------------------------------------------------------------------------------- 250 제 14 장디지털신호처리응용 3 --------------------------------------------- 253 과제 3 ------------------------------------------------------------------------------------- 253 참고문헌 --------------------------------------------------------------------------------------- 258
1 MATLAB Mathworks MATLAB. MATLAB MATLAB Toolbox. MATLAB MATLAB C C++., MATLAB C C++, DSP TMS320 Mathworks MATLAB.. 1. C C++ 2. TI TMS320C6000 Motolora M6800 3. Xilinx ALTERA EPLD(FPGA) HDL 4. x-pc MABLAB Emulation Simulink Labview MATLAB. MATLAB. MATLAB, MATLAB. MATLAB 1. Steven W. Smith, "The Scientist and Engineer's Guide to Digital Signal Processing" 2. Vinay K. Ingle, John G. Proakis, "Digital Signal Processing using the MATLAB" 3.
1.1 MATLAB. 1-1 ' ' ' [ ] ( ) ; :. (matrix) (transpose). ) a', A'. ) title('magnitude'),. ) a=[1 3 5 7], (function). ) a(1,2), max(a). ) a=sqrt(2)+exp(3);. ) t=[0:0.01:1];. ) c=a.^2, c=a./b % (comment line).... >> (variable) = (expression)
. 1-2 pi 3.1415926535897... i j inf NaN (, ),,, i j. (infinity). ( nonzeros ) / 0 (Not-a-number). 0 / 0 inf / inf 1) >>A=[1 4 8 6] % A = 1 4 8 6 >>A=[1; 4; 8; 6;] A = 1 4 8 6 % >>a=[1:4:1] % 1 4 1 a = 1 2 3 4 >>a=[9:-2:1] % 9 1-2 a = 9 7 5 3 1
2) >>A=[1 1 1;1 2 3;1 3 6] >>A= A = 1 1 1 1 2 3 1 3 6 % %,. 3) >> a=[1 2 3]; b=[4 5 6]; >> c= a.* b c = 4 10 18 >> a=[1-2 -3 6]; b=[-4 5-6 2]; >> y=a.^2 + b.^2 - a + b y = 12 36 42 36 >>A=[1 1 1;1 2 3;1 3 6]; >>sum(a) % sum(a). ans = 3 6 10 4) >> x=[-1 sqrt(3) 4/5] x = -1.0000 1.7321 0.8000
'x' '( )' (subscript). >>x(3) ans = 0.8000 >> a=[1 2 3; 4 5 6; 7 8 9] a = 1 2 3 4 5 6 7 8 9 >> a(1,3) ans = 3 >> a(2,2) ans = 5 >> a(3,2) ans = 8 >> a(1,:) % 1 ans = 1 2 3 >> a(:,2) % 2 ans = 2 5 8 >> a(3,2:3) % 3 2,3 ans = 8 9
>> a(2:3,2) % 2 2,3 ans = 5 8,.... >> P=[1, 2, 4, 6, 8]+[pi, 4, exp(1), 0, -1]+... [cos(0.1*pi), sin(pi/3), tan(3), atan(2), sqrt(pi)] P = 5.0926 6.8660 6.5757 7.1071 8.7725 5) >> a=[1 2 3 4 5; 2 4 6 8 10; 3 6 9 12 15] a = 1 2 3 4 5 2 4 6 8 10 3 6 9 12 15 >> a(1,3)=22.999 % 1 3-22.999 a = 1.0000 2.0000 22.9990 4.0000 5.0000 2.0000 4.0000 6.0000 8.0000 10.0000 3.0000 6.0000 9.0000 12.0000 15.0000 >> a(2,6)=-88.999 % 2 6-88.999 % 6 6. a = 1.0000 2.0000 22.9990 4.0000 5.0000 0 2.0000 4.0000 6.0000 8.0000 10.0000-88.9990 3.0000 6.0000 9.0000 12.0000 15.0000 0 >> a(3,5)=-55 % 3 5-55 a = 1.0000 2.0000 22.9990 4.0000 5.0000 0
2.0000 4.0000 6.0000 8.0000 10.0000-88.9990 3.0000 6.0000 9.0000 12.0000-55.0000 0 >> b=2*a % a 2 b = 2.0000 4.0000 45.9980 8.0000 10.0000 0 4.0000 8.0000 12.0000 16.0000 20.0000-177.9980 6.0000 12.0000 18.0000 24.0000-110.0000 0 6) (transpose : i j j i ) x " z' " (complex conjugate). x " z.' ". ". (dot) ". >>z=[1+2i 3+4i] z = 1.0000 + 2.0000i 3.0000 + 4.0000i >>z' ans = 1.0000-2.0000i 3.0000-4.0000i >>z.' ans = 1.0000 + 2.0000i 3.0000 + 4.0000i
1.2 (operators) 1) (Arithmetic Operators) 1. transpose( ".' " ), power ( ".^ " ), transpose( " ' " ), power( " ^ " ) 2. unary plus( " + " ), unary minus( " - " ) 3. ( " * " ), ( ". / " ), ( ". \ " ), ( " * " ), ( " / " ), ( " \ " ) 4. ( " + " ), ( " - " ) 5. colon ( " : " ) >>A=[3 9 5]; >>B=[2 1 5]; >>C=A./B.^2 % B.^2, A./. C = 0.7500 9.0000 0.2000 2) (Relational operators) (less), (not equal to)".. 1-3 < " (Less than)" <= " (Less than or equal to)" > " (Greater than)" >= " (Greater than or equal to)" == "(Equal to)" ~= " (Not equal to)"
>>A=[2 7 6;9 0-1;3.5 6]; % MATLAB 0. %, 0.123.123. >>B=[8 0.2 0;-3 2 5;4-1 7]; >>C= A<B C = 1 0 0 0 1 1 1 0 1 " find ".,.,,, " find ",. >>A=magic(4) % magic. A = 16 2 3 13 5 11 10 8 9 7 6 12 4 14 15 1 >>index=find(a > 8); >>A(index)=100 A = 100 2 3 100 5 100 100 8 100 7 6 100 4 100 100 1
3) (Logical Operators) "AND", "OR" TRUE", "FALSE".. 1-4 & AND OR ~ NOT 1.3 MATLAB sin(x) / cos(x) / tan(x) / asin(x) / acos(x) / atan(x) / exp(x) / log(x) / log10(x) / sqrt(x) / abs(x) / phase(x) / real(x) / imag(x) / conj(x) / mean(x) / std(x) / sum(x) / max(x) / min(x) / ceil(x) / floor(x) / round(x) / rem(x,y) / fix(x) / length(x) / size(x) / ones(rn,cn) / zeros(rn,cn) / eye(rn,cn) / linspace(sn,incn,en) / pi(=3.14159...) x=3+3j or x=3+3i or x=3+3*j or x=3+3*i clear all; close all; clc; disp('dsp').
1.4, 1) load save MATLAB, save.m, load.m. save.m *.mat file, load.m *.mat file. >> x=eye(3); y='dsp'; z=2+2i; >> save Data_file x y z, x, y, z DataFile.mat file. >>clear all >>load Data_file % base workspace., Data_file.mat file x, y, z base workspace. >> save output_filename variables (xxx.mat ) >> load data_filename.mat ASCII, >> save output_filename.dat variables -ascii( /ascii : ascii ) >> load data_filename.txt. 2) Low_level file I/O fopen.m fclose.m.
fprintf.m fscanf.m,. 3) input input. >> a=input(' a= ') a= 6 a = 6 >> x=a+a.^2; >> x x = 42 1.5 1) FOR for i = 1:10 end ; x=0; for i = 1:10 x=x+i; end x x = 55 2) IF if ( ) ; elseif ;
else end ; x=0; y=0; z=0; for k=0:1:100; if (2*round(k/2)==k) x=x+1; elseif (3*round(k/3)==k) y=y+1; else z=z+1; end end x y z x = y = z = 51 17 33 3) WHILE while ( ). ; end % n=1; while (prod(1:n)<1000) n=n+1; end n n = 7
4) SWITCH switch case 1, ; case 2, ;... otherwise ; end % 1 % 2 % case x=input(' x=') y=rem(x,2); switch y case 1, disp(' ') case 2, disp(' ') end x=45 x = 45 1.6 MATLAB
MATLAB. "plot" stem". PLOT 1) >> t=[0:0.1:2*pi]; >> y=sin(t); >> plot(t,y)
>> t=[0:0.1:2*pi]; >> y=sin(t); >> z=cos(t); >> plot(t,y,t,z) 3) hold >> hold on, hold on >> hold off.
>> x=0:.1:2*pi; >> y=sin(x); >> plot(x,y) >> grid on >> hold on >> plot(x,exp(-2*x),'r:*') STEM >> n=[0:0.2:2*pi]; >> y=sin(n); >> stem(n,y) >> stem(n,y,'filled')
log x, y log,. >>w=logspace(-2,2,1000); >>H=1./(1+w.^2).^0.5; >>subplot(1,3,1),semilogx(w,h); >>subplot(1,3,2),semilogy(w,h); >>subplot(1,3,3),loglog(w,h); subplot(,, ). >> subplot(2,2,1), plot(1:10) >> x = 0:.1:2*pi; >> subplot(2,2,2), plot(x,sin(x)) >> subplot(2,2,3), plot(x,exp(-x),'r') >> subplot(2,2,4), plot(x+sin(x)+exp(-x),'k')
'option'. >> plot(x,y,'option') >> x = 0:.1:2*pi; >> plot(x,sin(x),'r--d')
. 1-5 option option option option b blue. point - solid g green o circle : dotted r red x x-mark -. dashdot c cyan + plus -- dashed m magenta * star y yellow s square k black d diamond v ^ triangle (down) triangle(up) < triangle(left) > p triangle(right) pentagram h hexagram
>> x = 0:.1:2*pi; >> plot(x,sin(x),'r--d'); >> xlabel('frequency(w)'); >> ylabel('amplitude[v]'); >> title('sin function'); 1) >> xlabel('^ {super } and _ {sub }') 2) >> ylabel('some \bfboldface\rm and some \it {italics }') 3) >> text(3.5, 20, 'y = e^ { \alphax}sin( \betax)')
. 1-6.
Property Editor 1) Figure Property 2) Axes Property
1 MATLAB. 1. MATLAB 2. MATLAB MATLAB MATLAB MATLAB, 3. (1) MATLAB meditor. (2) MATLAB. (3).
[ 1].,. [ 2] sin cos. y1 y2.
[ 3] sin cos save ASCII. load,. "o". [ 4] "input" a,b,c,d,e a) b) log c) d) e) MATLAB..