toc issues
https://gitlab.irit.fr/groups/toc/-/issues
2022-10-21T14:35:03Z
https://gitlab.irit.fr/toc/etu-n7/integration/-/issues/2
Lemme de Fatou
2022-10-21T14:35:03Z
Olivier Cots
Lemme de Fatou
Voici [trois exemples](/uploads/66565d8143942a3202b7d825d93681e1/Fatou.pdf) où l'inégalité du lemme de Fatou est stricte. L'extrait est issu du livre [Intégration et Analyse de Fourier](https://cedricvillani.org/sites/dev/files/old_image...
Voici [trois exemples](/uploads/66565d8143942a3202b7d825d93681e1/Fatou.pdf) où l'inégalité du lemme de Fatou est stricte. L'extrait est issu du livre [Intégration et Analyse de Fourier](https://cedricvillani.org/sites/dev/files/old_images/2013/03/IAF.pdf) de Cédric Villani.
https://gitlab.irit.fr/toc/etu-n7/automatique/-/issues/2
Problème de dimension : size(X.data) == size(X_sol.data)
2022-10-12T19:50:41Z
Olivier Cots
Problème de dimension : size(X.data) == size(X_sol.data)
Si vous avez un message d'erreur comprenant :
```matlab
size(X.data) == size(X_sol.data)
```
alors cela peut venir des paramètres du composant `Constant` de Simulink. Attention, par défaut le composant `Constant` traite les vecteurs c...
Si vous avez un message d'erreur comprenant :
```matlab
size(X.data) == size(X_sol.data)
```
alors cela peut venir des paramètres du composant `Constant` de Simulink. Attention, par défaut le composant `Constant` traite les vecteurs comme des vecteurs colonnes. Cependant, la matrice de gain `K` est pour le pendule inversé un vecteur ligne. Pour régler ce problème il faut décocher la ligne `Interpret vector parameters as 1-D`, cf. :
![block_parameters_constant](/uploads/2339c8de6ae755eebe655a0bf73314b4/block_parameters_constant.png)
Si cela ne règle pas le problème, il y a sûrement un problème de dimensionnement des sorties Simulink vers le workspace. Pour régler cela, vous pouvez utiliser opérateur `reshape` de Simulink :
![Screenshot_2022-10-12_at_18.31.59](/uploads/8b700844c89634cddbf81ad13d731b07/Screenshot_2022-10-12_at_18.31.59.png)
https://gitlab.irit.fr/toc/etu-n7/automatique/-/issues/1
Problème d'affichage : XY Graph
2022-10-12T10:20:18Z
Olivier Cots
Problème d'affichage : XY Graph
Si aucun graphe ne s'affiche sur le composant `XY Graph`, suivre ces instructions :
![p9_XY_Graph1___-_Simulink_academic_use_2022-10-12_10-59-33](/uploads/250da3288570a83acb9e078bfc33729f/p9_XY_Graph1___-_Simulink_academic_use_2022-10-1...
Si aucun graphe ne s'affiche sur le composant `XY Graph`, suivre ces instructions :
![p9_XY_Graph1___-_Simulink_academic_use_2022-10-12_10-59-33](/uploads/250da3288570a83acb9e078bfc33729f/p9_XY_Graph1___-_Simulink_academic_use_2022-10-12_10-59-33.mp4)
https://gitlab.irit.fr/toc/maison-de-fermat/-/issues/2
Installation
2022-07-28T14:01:03Z
Olivier Cots
Installation
```bash
conda update -n base -c defaults conda
conda create --name julia
conda activate julia
conda install -c conda-forge mamba
mamba install -c conda-forge julia
mamba install -c conda-forge jupyterlab
```
Dans julia...
```bash
conda update -n base -c defaults conda
conda create --name julia
conda activate julia
conda install -c conda-forge mamba
mamba install -c conda-forge julia
mamba install -c conda-forge jupyterlab
```
Dans julia...
https://gitlab.irit.fr/toc/maison-de-fermat/-/issues/1
Animation transfert orbital
2022-07-21T22:10:18Z
Olivier Cots
Animation transfert orbital
Cette page sert à d'éventuelles remarques concernant l'animation.
Cette page sert à d'éventuelles remarques concernant l'animation.
https://gitlab.irit.fr/toc/ens-n7/controle-optimal/etudiants/-/issues/3
TP Transfert Orbital - Affichage
2022-05-24T06:10:54Z
Olivier Cots
TP Transfert Orbital - Affichage
Vous pouvez remplacer la cellule contenant la fonction d'affichage par le code suivant (pour afficher l'animation il faut appeler la fonction `plot_solution` avec l'argumetn `animation=true`) :
```julia
# Corps du satellite
@userplot Sa...
Vous pouvez remplacer la cellule contenant la fonction d'affichage par le code suivant (pour afficher l'animation il faut appeler la fonction `plot_solution` avec l'argumetn `animation=true`) :
```julia
# Corps du satellite
@userplot SatBody
@recipe function f(cp::SatBody)
x, y = cp.args
seriestype --> :shape
fillcolor --> :goldenrod1
linecolor --> :goldenrod1
x, y
end
@userplot SatLine
@recipe function f(cp::SatLine)
x, y = cp.args
linecolor --> :black
x, y
end
# Bras du satellite
@userplot SatBras
@recipe function f(cp::SatBras)
x, y = cp.args
seriestype --> :shape
fillcolor --> :goldenrod1
linecolor --> :white
x, y
end
# panneau
@userplot PanBody
@recipe function f(cp::PanBody)
x, y = cp.args
seriestype --> :shape
fillcolor --> :dodgerblue4
linecolor --> :black
x, y
end
# flamme
@userplot Flamme
@recipe function f(cp::Flamme)
x, y = cp.args
seriestype --> :shape
fillcolor --> :darkorange1
linecolor --> false
x, y
end
function satellite!(pl; position=[0;0], scale=1, rotate=0)
# Fonctions utiles
R(θ) = [ cos(θ) -sin(θ)
sin(θ) cos(θ)] # rotation
T(x, v) = x.+v # translation
H(λ, x) = λ.*x # homotéthie
SA(x, θ, c) = c .+ 2*[cos(θ);sin(θ)]'*(x.-c).*[cos(θ);sin(θ)]-(x.-c) # symétrie axiale
#
O = position
Rθ = R(rotate)
# Paramètres
α = π/10.0 # angle du tube, par rapport à l'horizontal
β = π/2-π/40 # angle des bras, par rapport à l'horizontal
Lp = scale.*1.4*cos(α) # longueur d'un panneau
lp = scale.*2.6*sin(α) # largueur d'un panneau
# Param bras du satellite
lb = scale.*3*cos(α) # longueur des bras
eb = scale.*cos(α)/30 # demi largeur des bras
xb = 0.0
yb = scale.*sin(α)
# Paramètres corps du satellite
t = range(-α, α, length = 50)
x = scale.*cos.(t);
y = scale.*sin.(t);
Δx = scale.*cos(α)
Δy = scale.*sin(α)
# Paramètres flamme
hF = yb # petite hauteur
HF = 2*hF # grande hauteur
LF = 5.5*Δx # longueur
# Dessin bras du satellite
M = T(Rθ*[ [xb-eb, xb+eb, xb+eb+lb*cos(β), xb-eb+lb*cos(β), xb-eb]';
[yb, yb, yb+lb*sin(β), yb+lb*sin(β), yb]'], O);
satbras!(pl, M[1,:], M[2,:])
M = T(Rθ*[ [xb-eb, xb+eb, xb+eb+lb*cos(β), xb-eb+lb*cos(β), xb-eb]';
-[yb, yb, yb+lb*sin(β), yb+lb*sin(β), yb']'], O);
satbras!(pl, M[1,:], M[2,:])
# Dessin flamme
M = [0 -LF -LF 0
-hF/2 -HF/2 HF/2 hF/2]
M = T(Rθ*T(M, [-Δx; 0]), O)
flamme!(pl, M[1, :], M[2, :])
# Dessin corps du satellite
M = T(Rθ*[ x'; y'], O); satbody!(pl, M[1,:], M[2,:]) # bord droit
M = T(Rθ*[-x'; y'], O); satbody!(pl, M[1,:], M[2,:]) # bord gauche
M = T(Rθ*[scale.*[-cos(α), cos(α), cos(α), -cos(α)]'
scale.*[-sin(α), -sin(α), sin(α), sin(α)]'], O);
satbody!(pl, M[1,:], M[2,:]) # interieur
M = T(Rθ*[ x'; y'], O); satline!(pl, M[1,:], M[2,:]) # bord droit
M = T(Rθ*[-x'; y'], O); satline!(pl, M[1,:], M[2,:]) # bord gauche
M = T(Rθ*[ x'.-2*Δx; y'], O); satline!(pl, M[1,:], M[2,:]) # bord gauche (droite)
M = T(Rθ*[ scale.*[-cos(α), cos(α)]';
scale.*[ sin(α), sin(α)]'], O);
satline!(pl, M[1,:], M[2,:]) # haut
M = T(Rθ*[ scale.*[-cos(α), cos(α)]';
-scale.*[ sin(α), sin(α)]'], O);
satline!(pl, M[1,:], M[2,:]) # bas
# Panneau
ep = (lb-3*lp)/6
panneau = [0 Lp Lp 0
0 0 lp lp]
ey = 3*eb # eloignement des panneaux au bras
vy = [cos(β-π/2); sin(β-π/2)] .* ey
v0 = [0; yb]
v1 = 2*ep*[cos(β); sin(β)]
v2 = (3*ep+lp)*[cos(β); sin(β)]
v3 = (4*ep+2*lp)*[cos(β); sin(β)]
pa1 = T(R(β-π/2)*panneau, v0+v1+vy); pa = T(Rθ*pa1, O); panbody!(pl, pa[1,:], pa[2,:])
pa2 = T(R(β-π/2)*panneau, v0+v2+vy); pa = T(Rθ*pa2, O); panbody!(pl, pa[1,:], pa[2,:])
pa3 = T(R(β-π/2)*panneau, v0+v3+vy); pa = T(Rθ*pa3, O); panbody!(pl, pa[1,:], pa[2,:])
pa4 = SA(pa1, β, [xb; yb]); pa = T(Rθ*pa4, O); panbody!(pl, pa[1,:], pa[2,:])
pa5 = SA(pa2, β, [xb; yb]); pa = T(Rθ*pa5, O); panbody!(pl, pa[1,:], pa[2,:])
pa6 = SA(pa3, β, [xb; yb]); pa = T(Rθ*pa6, O); panbody!(pl, pa[1,:], pa[2,:])
pa7 = SA(pa1, 0, [0; 0]); pa = T(Rθ*pa7, O); panbody!(pl, pa[1,:], pa[2,:])
pa8 = SA(pa2, 0, [0; 0]); pa = T(Rθ*pa8, O); panbody!(pl, pa[1,:], pa[2,:])
pa9 = SA(pa3, 0, [0; 0]); pa = T(Rθ*pa9, O); panbody!(pl, pa[1,:], pa[2,:])
pa10 = SA(pa7, -β, [xb; -yb]); pa = T(Rθ*pa10, O); panbody!(pl, pa[1,:], pa[2,:])
pa11 = SA(pa8, -β, [xb; -yb]); pa = T(Rθ*pa11, O); panbody!(pl, pa[1,:], pa[2,:])
pa12 = SA(pa9, -β, [xb; -yb]); pa = T(Rθ*pa12, O); panbody!(pl, pa[1,:], pa[2,:])
end;
@userplot TrajectoryPlot
@recipe function f(cp::TrajectoryPlot)
t, x, y, tf = cp.args
n = argmin(abs.(t.-tf))
inds = 1:n
seriescolor --> :white
linewidth --> range(0, 5, length = n)
seriesalpha --> range(0, 1, length = n)
aspect_ratio --> 1
label --> false
x[inds], y[inds]
end
# Fonction d'affichage d'une solution
function plot_solution(p0, tf; animation=false, fps=10, nFrame=200)
# On trace l'orbite de départ et d'arrivée
gr(dpi=300, size=(500,400), thickness_scaling=1)
r0 = norm(x0[1:2])
v0 = norm(x0[3:4])
a = 1.0/(2.0/r0-v0*v0/μ)
t1 = r0*v0*v0/μ - 1.0;
t2 = (x0[1:2]'*x0[3:4])/sqrt(a*μ);
e_ellipse = norm([t1 t2])
p_orb = a*(1-e_ellipse^2);
n_theta = 151
Theta = range(0, stop=2*pi, length=n_theta)
X1_orb_init = zeros(n_theta)
X2_orb_init = zeros(n_theta)
X1_orb_arr = zeros(n_theta)
X2_orb_arr = zeros(n_theta)
# Orbite initiale
for i in 1:n_theta
theta = Theta[i]
r_orb = p_orb/(1+e_ellipse*cos(theta));
X1_orb_init[i] = r_orb*cos(theta);
X2_orb_init[i] = r_orb*sin(theta);
end
# Orbite d'arrivée
for i in 1:n_theta
theta = Theta[i]
X1_orb_arr[i] = rf*cos(theta) ;
X2_orb_arr[i] = rf*sin(theta);
end;
# Calcul de la trajectoire
ode_sol = f((t0, tf), x0, p0)
t = ode_sol.t
n = size(t, 1)
x1 = [ode_sol[1, j] for j in 1:n ]
x2 = [ode_sol[2, j] for j in 1:n ]
v1 = [ode_sol[3, j] for j in 1:n ]
v2 = [ode_sol[4, j] for j in 1:n ]
u = zeros(2, length(t))
for j in 1:size(t, 1)
u[:,j] = control(ode_sol[5:8, j])
end
ee = 0.2
xmin = minimum([x1; X1_orb_init; X1_orb_arr]); xmin = xmin - ee * abs(xmin);
xmax = maximum([x1; X1_orb_init; X1_orb_arr]); xmax = xmax + ee * abs(xmax);
ymin = minimum([x2; X2_orb_init; X2_orb_arr]); ymin = ymin - ee * abs(ymin);
ymax = maximum([x2; X2_orb_init; X2_orb_arr]); ymax = ymax + ee * abs(ymax);
if animation
nFrame = min(nFrame, n);
anim = @animate for i ∈ 1:nFrame
px = plot(background_color=:gray26, xlims=(xmin, xmax), ylims=(ymin, ymax),
legend = false, framestyle = :none, aspect_ratio=:equal)
plot!(px, X1_orb_init, X2_orb_init, color = :olivedrab1, linewidth=2)
plot!(px, X1_orb_arr, X2_orb_arr, color = :turquoise1, linewidth=2)
plot!(px, [0.0], [0.0], color = :steelblue2, seriestype=:scatter, markersize = 20, markerstrokewidth=0)
trajectoryplot!(px, t, x1, x2, i*tf/nFrame)
tcur = i*tf/nFrame
indf = argmin(abs.(t.-tcur))
plot!(px, [x1[1]], [x2[1]], seriestype=:scatter, color = :white, markerstrokewidth=0)
satellite!(px, position=[x1[indf];x2[indf]], scale=2000, rotate=atan(u[2, indf], u[1, indf]))
end
gif(anim, "anim.gif", fps=fps);
else
pu1 = plot(t, u[1,:], color = :red, xlabel = "t", ylabel = "u1", legend = false)
pu2 = plot(t, u[2,:], color = :red, xlabel = "t", ylabel = "u2", legend = false)
px = plot(background_color=:gray26, xlims=(xmin, xmax), ylims=(ymin, ymax),
legend = false, framestyle = :none, aspect_ratio=:equal)
plot!(px, X1_orb_init, X2_orb_init, color = :olivedrab1, linewidth=2)
plot!(px, X1_orb_arr, X2_orb_arr, color = :turquoise1, linewidth=2)
plot!(px, [0.0], [0.0], color = :steelblue2, seriestype=:scatter, markersize = 20, markerstrokewidth=0)
plot!(px, [x1[1]], [x2[1]], seriestype=:scatter, color = :white, markerstrokewidth=0)
plot!(px, x1, x2, color = :white, size = (800, 800), linewidth = range(0, 5, length = n))
satellite!(px, position=[x1[end];x2[end]], scale=2000, rotate=atan(u[2, end], u[1, end]))
display(plot(pu1, pu2, layout = (1,2), size = (800,400)))
display(px)
end
end;
```
https://gitlab.irit.fr/toc/ens-n7/controle-optimal/etudiants/-/issues/2
TP 2 - Ex 2
2022-05-17T09:02:01Z
Olivier Cots
TP 2 - Ex 2
```julia
t0 = 0.
tf = 1.
x0 = [0.; 0.]
α = 1.
function hv(x, p)
return [p[1]; α+p[2]; 0.; 0.]
end
z = Flow(hv)
function shoot(p0)
xf, pf = z(t0, x0, p0, tf)
return [xf[1]-1.; pf[2]]
end
jshoot(p0) = ForwardDiff.jacobian...
```julia
t0 = 0.
tf = 1.
x0 = [0.; 0.]
α = 1.
function hv(x, p)
return [p[1]; α+p[2]; 0.; 0.]
end
z = Flow(hv)
function shoot(p0)
xf, pf = z(t0, x0, p0, tf)
return [xf[1]-1.; pf[2]]
end
jshoot(p0) = ForwardDiff.jacobian(shoot, p0)
p0_guess = [0.1; 0.1]
sol = nlsolve(shoot, jshoot, p0_guess; xtol=1e-8, method=:trust_region, show_trace=true);
p0_sol = sol.zero;
```
![Capture_d_écran_2022-05-17_à_11.01.46](/uploads/d4bf48050fda231caef58058e0f9fd5e/Capture_d_écran_2022-05-17_à_11.01.46.png)
```julia
ode_sol = z((t0, tf), x0, p0_sol);
#
plt = plot([1, 1], [-2, 2], c="blue", xlabel="x1", ylabel="x2", linewidth=2.0) # cible
annotate!(plt, 1.05, -1.0, text("c=0", :left, :blue, 12))
# trajectoire optimale
t = ode_sol.t
x = ode_sol[1:2, :]
p = ode_sol[1:2, :]
i = argmin(abs.(t.-(t0+tf)/2.0))
plot!(plt, x[1, 1:i], x[2, 1:i], c="red", legend=false, xlims=(0,2.5), linewidth=2.0, arrow=arrow(:closed, :head))
plot!(plt, x[1, i:end], x[2, i:end], c="red", legend=false, xlims=(0,2.5), linewidth=2.0)
annotate!(plt, x[1,i], x[2,i]-0.2, text("x(•)", :top, :red, 12))
#
zf = ode_sol[:, end]
xf = zf[1:2]
pf = zf[3:4]
quiver!(plt, [xf[1]], [xf[2]], quiver=([pf[1]], [pf[2]]), c="green", linewidth=2.0) # vecteur adjoint final
annotate!(plt, xf[1]+0.5*pf[1], xf[2]+0.5*pf[2]-1e-1, text("p(tf)", :top, :green, 12))
```
![Capture_d_écran_2022-05-17_à_11.01.09](/uploads/e2a3183e553e53a960e08cf44171e5aa/Capture_d_écran_2022-05-17_à_11.01.09.png)
https://gitlab.irit.fr/toc/etu-n7/integration/-/issues/1
Fonction de répartition et ensemble de discontinuités
2021-10-26T15:38:44Z
Olivier Cots
Fonction de répartition et ensemble de discontinuités
![d08622d0-8d89-469b-8155-fca02401af7a](/uploads/02c21a85c617faae49431ff9417f113b/d08622d0-8d89-469b-8155-fca02401af7a.jpg)![4c997e75-114e-4415-ba40-6fe2fa75ae01](/uploads/c59e2d8989792bf554e8f6d9c4c72928/4c997e75-114e-4415-ba40-6fe2fa75...
![d08622d0-8d89-469b-8155-fca02401af7a](/uploads/02c21a85c617faae49431ff9417f113b/d08622d0-8d89-469b-8155-fca02401af7a.jpg)![4c997e75-114e-4415-ba40-6fe2fa75ae01](/uploads/c59e2d8989792bf554e8f6d9c4c72928/4c997e75-114e-4415-ba40-6fe2fa75ae01.jpg)