% BODE % This program takes four parameters in what could be % either an amplitude or a phase Bode plot: % y1: decibels (or degrees) at the known end of the % inclined segment (could be the left or right end). % w1: angular frequency (rad/s) at y1. % w2: angular frequency (rad/s) at the far end from y1. % slope: slope of the segment going from w1 to w2, that % means that the slope would go from right to left % if the end point of the segment that we know is % the right end. % Output: % It echos w1 w2 y1 the slope and gives new: % y2: the vertical value (dB or deg) at w2. % dy: vertical drop (or climb) in dB or deg. % dec: distance from w1 to w2 in decades. % % By L.Linares 2011 % % y1--+ % |\ % | \ (negative slope from w1 to w2) % \ % w1 \ % +---y2 % | % w2 % % y2--+ % |\ % | \ (positive slope from w1 to w2) % \ % w2 \ % +---y1 % | % w1 % VERY IMPORTANT: To type this program on a regular % text file, I had to replace some HP50 keys by % certain strings. So ... % Where I wrote you type % * [multiply key] % ACOS [WHITE SHIFT] COS % ^ [y to the x key] % SQRT press square root key (*) % ->TAG [WHITE SHIFT] PRG/TYPE/->TAG % -> [RED SHIFT] [zero key] % (*) Do NOT type the letters SQRT ... it won't work! % I "travel" along the plot, from the first "knee" to the % second, then check the echoed data, delete all but the % new y2 just computed, and enter the new w1 w2 slope, etc. % Modification on April 15, 2011: % The two system flags -3 and -105 are set to ensure % numerical results, but are set back to their original % values, so the user sees the same functionability that % he/she was using before issuing a call to BODE. % This program is provided on a "as is" basis, for % reference ONLY, and no warranty of its accuracy or % correctness is made. If you use it, you use it at your % own risk. << "Y1 W1 W2 SLOPE" PROMPT -3 FS? -105 FS? -> Y1 W1 W2 SLP F3 F105 << 'LOG(W2/W1)' EVAL DUP SLP * -> DX DY << Y1 'Y1' ->TAG Y1 DY + 'Y2' ->TAG W1 'W1' ->TAG W2 'W2' ->TAG SPL 'slope' ->TAG DX 'dec' ->TAG DY 'Dy' ->TAG IF 'F3==0' THEN -3 SF END IF 'F105==0' THEN -105 SF END >> >> >>