Wednesday, April 5, 2017

HP Prime: Magnitude Bode Plot



HP Prime:  Magnitude Bode Plot

How BODEPLOT Works

The program BODEPLOT for the HP Prime plots a handmade Bode Plot for any of the following forms:

(I) H(s) = K * (s/A + 1)/(s/B + 1)
(II) H(s) = K * (s/A + 1)
(III) H(s) = K * 1/(s/B + 1)

with K = constant, -A = real root, -B = real pole

The input screen:



For type (II), enter 0 for B.  For type (III), enter 0 for A.  K must be nonzero, and it is assumed that K is positive.  The plot is made of a composition of two or three basic plots.

One thing to know:  the program simulates semi-log plot.  The X axis represents values of 10^x.  Hence, X = 0 represents 1, X = 1 represents 10, X = 2 represents 100, and so on.  Hence, each X represents a decade (instead of the customary unit). 

HP Prime Program BODEPLOT

EXPORT BODEPLOT()
BEGIN
// Bode Magnitude Plot
// K*(s/A+1)/(s/B+1)
// 2017-04-05 EWS

INPUT({K,A,B},
"Mag.: K*(s/A+1)/(s/B+1)",
{"Const (K): ","Zero (−A): ",
"Pole (−B): "},
{"Constant","Zero","Plot"});


F1:="20*LOG(K)";
F2:="PIECEWISE(X≤LOG(A),0,
X>LOG(A),20X-20LOG(A))";
F3:="PIECEWISE(X≤LOG(B),0,
X>LOG(B),−20X+20LOG(B))";
F4:="F1(X)+F2(X)+F3(X)";

// dark red color
F4(COLOR):=#800000h;

IF A==0 THEN
F2:="0";
END;

IF B==0 THEN
F3:="0";
END;

STARTAPP("Function");
CHECK(4);
UNCHECK(1);
UNCHECK(2);
UNCHECK(3);
// Autoscale
STARTVIEW(10,1);

END;

Examples

Example 1:  K = 1.02, A = 100, B = 250   (root = -100, pole = -250)


Example 2:  K = 1.02, A = 100  (no pole, B = 0)


Example 3:  K = 1.02, B = 250  (no root, A = 0)


Since the plots are first generated in Autoscale, I executed a Zoom Out (2 x 2) after program execution.

Sources:

“Bode Plot”  Wikipedia.  Last edited February 7, 2017.  https://en.wikipedia.org/wiki/Bode_plot   Retrieved March 6, 2017

Cheever, Eric.  “Bode Plot: Examples”  Swarthmore College.  2015.  Link:  http://lpsa.swarthmore.edu/Bode/BodeExamples.html   Retrieved March 6, 2017


This blog is property of Edward Shore, 2017.


TI 84 Plus CE: Consolidated Debts

TI 84 Plus CE: Consolidated Debts   Disclaimer: This blog is for informational and academic purposes only. Financial decisions are your ...