26_freqgW12 - Page 1 of 3 Computer Shortcut: freqg.p CHE...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Page 1 of 3 Computer Shortcut: freqg.p CHE 361 Task: Use the MATLAB "program" file freqg.p to determine the frequency response of: G( s) = 2e −0.2 s for the freqency range of ω from 0.01 to 10 rad/min 10s + 1 Then check the amplitude ratio and phase angle at 2 rad/min by "hand" using the shortcut method. To "run" the program, simply type >>freqg at the prompt in the MATLAB Command Window. Here's what you should see, with bold letters indicating what you enter: >> freqg |----------------------------------------------------| | MATLAB Program "freqg" | | Uses "shortcut" method to calculate frequency | | response of G(s) where G(s) has a polynomial | | numerator and denominator and a single time delay. | | Saves results freq,RePart,ImPart,AR,Phase in deg | | in columns in a file specified by the user. | | Example: 2s^2 + 0s + 1 = [2, 0, 1] | | Dr. K.L. Levien Nov. 12, 2003 | | Revisions: 11/8/04, 2/20/08, 2/15/12 | | Chemical Engineering, Oregon State University | |----------------------------------------------------| --------------------------------------------Enter numerator coefficient vector: [2] Numerator Vector = [2] Enter denominator coefficient vector: [10, 1] Denominator Vector = [10, 1] G ( s) = N ( s ) −θ s e D( s) Enter time delay: 0.2 Time Delay = 0.2 Enter minimum frequency, rad/time (0.01) = 0.01 Enter maximum frequency, rad/time (10) = 10 Enter number of frequencies to use (100) = 100 Hit Enter to use default data file name 'freqg.dat' or enter the desired name of the file. Enter name of data file to save (freqg.dat) : freqg1.dat |----------------------------------------------------------| | Data has been saved in a file named freqg1.dat |----------------------------------------------------------| >> The main problem in applying the shortcut method using a computer is the need to keep track of the phase angle properly as the frequency increases. This is difficult because trig functions are periodic with a period of 2π radians. For example, the polar angle of a point in the G(jω) plane at +1 - 1j could be at - 45 deg or -45 - 360 = - 405 deg. From a practical standpoint, if more frequencies are used between the lower and upper limits, it is easier for the MATLAB command "unwrap" to be able to draw a nice Bode plot. Page 2 of 3 Once you have created the freqg.dat, you can enter the following command in the Command Window to draw the Bode plot for the data: >>chebode Amplitude Ratio 10 10 10 1 Bode Plot: made by chebode using freqg.dat 0 -1 -2 10 -2 10 10 -1 0 -1 0 10 Frequency (rad/min) 10 1 0 Phase (deg) -45 -90 -135 -180 -225 -270 -2 10 Amplitude Ratio 10 10 10 1 10 10 Frequency (rad/min) 10 1 Amplitude Ratio Plot: made by chebode using freqg.dat 0 -1 -2 10 -2 10 10 -1 10 Frequency (rad/min) 0 10 1 Page 3 of 3 Phase Angle (degs) Plot: made by chebode using freqg.dat 0 -45 Phase (deg) -90 -135 -180 -225 -270 -2 10 10 -1 10 Frequency (rad/min) 0 10 1 chebode.p = makes one curve on a Bode plot using data in the file freqg.dat in format with 5 columns: freq, RealG, ImgG, AR, phase angle in degrees = the "freqg.p" format. chebodei.p = similar, but interactive to ask for name of file. When you want to compare two Bode plots on the same set of axes, you can use the file chebode2i.p, which reads two (2) data files with names entered by the user. The data in the first data file is plotted using solid lines while the second data file is plotted with dashed lines. The same 3 plots are made, but each displays 2 curves. When you use the “pulse experiment analysis button”, for example with the Bioreactor Project, a file freqg.dat is created. Simply copy or rename that file for appropriate use with chebode2i.p. The command "grid" can be entered in the MATLAB Command Window to turn OFF the grid lines for easier comparisons of the curves. Each subplot needs to be clicked on to become the active region. Amplitude Ratio 10 10 10 1 Bode Plot: chebode2, solid=freqg1.dat, dash=freqg2.dat 0 -1 -2 10 -2 10 10 -1 0 -1 0 10 Frequency (rad/min) 10 1 0 Phase (deg) -45 -90 -135 -180 -225 -270 -2 10 10 10 Frequency (rad/min) 10 1 ...
View Full Document

Ask a homework question - tutors are online