summaryrefslogtreecommitdiffhomepage
path: root/digital/asserv/models/pwm.m
blob: 30d3d94bb4f95e37dac64aad9019f1f86e73a3c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
% Show influence of PWM control over voltage control.
motor;

%global to_file = 1;

global sys;
sys.motor = re40g;
sys.gear = gear4x;
sys.load = robot10w80;
sys.load.J /= 2; % Two motors.
sys.control.func = "pwm";
sys.control.period = 1/20000;

% PWM: 50%
sys.control.pwm = 0.5;
plotterm ("pwm");
sys_plot (10/20000);

% Voltage: 50%
sys.control.pwm = 1;
sys.motor.u *= 0.5;
plotterm ("voltage");
sys_plot (10/20000);