Control barrier functions basic example in 1d

34 Ansichten (letzte 30 Tage)
Hortencia Alejandra Ramírez Vázquez
Hortencia Alejandra Ramírez Vázquez am 14 Nov. 2024 um 20:24
Bearbeitet: Voss am 14 Nov. 2024 um 21:13
Hi,
I'm trying to program a basic example of a control barrier functions, for a system of 1D. The idea is that this system should not go for the negatives values .
The dynamic of my system is defined by ,
The function h that is the constinst restriction is given by , such that
The enforce condition is given by,
The question is that I don't know how to program this example, I tried with the assumption that
But my code is not working.
This is my code
%% CASE: x \in R, x can only take positive values
%time interval
t_int = 0:0.001:20;
%initial condition
x_0 = 10;
b = 0.00000001;
%differential eqation
dxdt = @(t, x) -1 - x;
[t, x] = ode45(dxdt, t_int, x_0);
% Graficar la solución
figure;
plot(t, x);
xlabel('Time');
ylabel('x(t)');
grid on;
Can someone help me?
  2 Kommentare
Torsten
Torsten am 14 Nov. 2024 um 20:54
Bearbeitet: Torsten am 14 Nov. 2024 um 20:55
I'm completely unable to follow what you try to do.
William Rose
William Rose am 14 Nov. 2024 um 21:09
Bearbeitet: Voss am 14 Nov. 2024 um 21:13
I agree with @Torsten. I am unable to understand the dynamics of hte system you wish to simulate. You define b in your code but uyou do not use b in the differential equation, and you do not refer to b in your explanation.
The differential equation you use in your code
dx/dt=-x-1
is a decaying exponential which decays to x=-1, with time constant=1.
%% CASE: x \in R, x can only take positive values
%time interval
tSpan = [0,20];
%initial condition
x_0 = 10;
b = 0.00000001; % not used
%differential eqation
dxdt = @(t, x) -1 - x;
[t, x] = ode45(dxdt, tSpan, x_0);
% Graficar la solución
figure;
plot(t, x);
xlabel('Time');
ylabel('x(t)');
grid on;

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Global or Multiple Starting Point Search finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by