Bode Magntiude Plot
04-06-2017, 01:17 AM
Post: #1
 Eddie W. Shore Senior Member Posts: 1,014 Joined: Dec 2013
Bode Magntiude Plot
For details and examples: http://edspi31415.blogspot.com/2017/04/h...-plot.html

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

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

Code:
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;
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)