Introduction
The aim of the Bode Plot Engine is to emulate MatLab's(r) by MathWorks(c) ability to parse and plot the magnitude and phase of continuous transfer functions. The Bode Plot Engine is a computing and plotting environment with combined symbolic and numerical inputs. The purpose behind providing the engine is simple: not everyone has access to MatLab. Alternatively, there might not a free license at the time or simply one would like to explore the design of control systems online on a machine without installed MatLab.
Bode Plot Engine structure
The Bode Plot Engine consists of these self-explanatory blocks:
Syntax
The syntax is mostly cross-compatible with MatLab.
Engine Control
Help
Numerical input
Variable assignment
Plotting
1st plot
2nd plot
3rd plot
4th plot
5th plot
6th plot
H = 1/s^3;
H2 = H+5*s^2
bode(H)
bode(H2,2)
Vectorization
w_max = 3
w_min = 0
vec = [1,2,3,4,5,6]
H = 10/(s+10*vec+10)*vec
bode(H,vec)
Cursors
Variables
Supported / Not Supported Syntax
Syntax | Remark |
---|---|
s^-1 | Not supported. Please use 1/s instead. |
6^3 | Not supported. Please use 6*6*6 instead. |
s^x, x>9 | Not supported. Please use MatLab for extreme case transfer functions. JavaScript does not have the required numerical precision. |
% this is a comment | Such line is not parsed. |
Examples
The following example shows the design of a simple closed-loop coil current controller:
clf; clear; clc;
w_min = -2; % Set min omega to 10^-1
w_max = 3; % Set max omega to 10^3
L = 0.01; % Coil inductance
R= 0.2; % Coil resistance
G = 1/(s*L+R); % Coil transfer function
w = 10; % Desired crossover frequency
Kp = w * L; % Proportional gain
Ki = R / L * 3*Kp; % Integral gain
PI = Kp + Ki/s; % Controller transfer function
OL = PI * G; % Open-loop transfer function
bode(G); % 1st plot
bode(PI,2); % 2nd plot
bode(OL,3); % 3rd plot
Variable Evaluation
It is possible to use the Bode Plot Engine as a calculator - that is, all symbolic variables can be evaluated and displayed.
Two examples are shown below:
Behind the Scene
Variable Repository
Each variable is stored as an array with four variables: ID, Name, Input, and Parsed Value
Change log
12/1/2017
1/29/2018
4/15/2018
4/22/2018
7/15/2018