90 likes | 189 Views
Unit 2 Discrete System. 中華技術學院電子系 蔡樸生 副教授 林盈灝 副教授. PROGRAM M-File. The method for custom user with common purpose for simulation is strongly recommended. There are some bugs in Matlab 4.0 and be updated 1. Using ‘MD’ to set up ‘c:matlabsimu’ 2. Update your ‘*.bat ’
E N D
Unit 2 Discrete System 中華技術學院電子系 蔡樸生 副教授 林盈灝 副教授
PROGRAM M-File • The method for custom user with common purpose for simulation is strongly recommended. • There are some bugs in Matlab 4.0 and be updated 1. Using ‘MD’ to set up ‘c:\matlab\simu’ 2. Update your ‘*.bat ’ 3. When you save M-file, Matlab4.0 notes the file name ~.txt automatically, rename ~.txt to ~.m. Matlab File New m-file Edit Save Run
Sinewave Generator • For :Repeat statements a specific number of times. for i = 1:n, for j = 1:n, A( i , j ) = 1/(i + j - 1); end end • Sinewave Generator for k=1:100, x(k)=(k*2*pi)/100; y(k)=sin(x(k)); end plot(x,y,’y’);
Digital Oscillator – Sinewave (I) • Principle: Continuous Function Discrete Function • Z Transform :
Digital Oscillator – Sinewave (II) Impulse Function
Digital Oscillator – Sinewave (II) • Formula: • Design Spec. :
Matlab Program clear; a=1.62;b=-1;c=0.59;dt=0.0001; y(1)=c;y(2)=a*y(1); t(1)=1*dt;t(2)=2*dt; for k=3:200 t(k)=dt*k; y(k)=a*y(k-1)+b*y(k-2); end plot(t,y); grid;
Homework ( I ) • Plot the diagram verify the Nyquist theorem (sampling theorem) by difference equation. Signal frequency is 10Hz. • The sampling frequency be at least twice the highest frequency in the signal for perfect reconstruction (2) Compute the output sequence of difference equation
(3) Elliptical plot (4) Curve Equation