Control barrier functions basic example in 1d
17 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hortencia Alejandra
el 14 de Nov. de 2024
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
.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1807978/image.png)
The dynamic of my system is defined by
,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1807983/image.png)
The function h that is the constinst restriction is given by
, such that
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1807988/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1807993/image.png)
The enforce condition is given by,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1807998/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1808003/image.png)
The question is that I don't know how to program this example, I tried with the assumption that
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1808008/image.png)
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 comentarios
William Rose
el 14 de Nov. de 2024
Editada: Voss
el 14 de Nov. de 2024
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;
Respuesta aceptada
Ashok
el 25 de Nov. de 2024
Editada: Ashok
el 25 de Nov. de 2024
From the equations mentioned in the query, it seems the condition for the system is incorrectly stated as
, and should instead be
, where
is a class-K function. Additionally, the equation
, suggests that the class-K function is chosen to be
.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1812988/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1812993/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1812998/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1813003/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1813008/image.png)
To ensure the condition
on the control input, u can be chosen as
, where ρ is a positive constant. However, the below line in the shared code suggests that the constant is chosen as
which is contradictory.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1813003/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1813018/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1813023/image.png)
dxdt = @(t, x) -1 - x;
To resolve the issue, replace ‘-1’ in the above line with some positive constant. Here’s a plot showing the system response for different values of ρ.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1813028/image.png)
Kindly refer the following link to read more about Barrier Certificate Enforcement:
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Global or Multiple Starting Point Search en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!