HW#3 Reference: How to Use MATLAB to Draw Bode Diagrams MATLAB codes for your reference (Using computer Lab in E213 or E215): Example: Given a Low-pass RC filter with R = 1 k, C = 0.1 F, draw a bode diagram of the system. Solution: To use MATLAB to draw the Bode diagram, you need to write out the filter’s transfer function first. For the RC filter, the transfer function is: Vout 1 0 j 1 Vin j RC 1 0.0001 j 1 In MATLAB window, type in the following comments based on the above Transfer Function: » NUM=[0 1]; » DEN=[.0001 1]; » SYS=TF(NUM,DEN); » bode(SYS) » grid; » grid; % if numerator is (0j +1) % if denominator is (0.0001j+1) % define the transfer function % draw bode plot % put grid in the magnitude plot by click the plot first % put grid in the phase angle plot by click the plot first Then you will get the bode plot as follows: You can use the similar codes to draw a High-pass filter response by using the corresponding HP filter Transfer function. Dr. Winncy Du, E310F, MAE Dept., SJSU, Tel.:408-924-3866,E-mail: winncy.du@.sjsu.edu Course Web: www.engr.sjsu.edu/wdu/ME106Spring2010