-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.c*scratch*
65 lines (56 loc) · 1.5 KB
/
test.c*scratch*
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, first visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
void main(void) {
// 09/12/2019 à 11:53 d'après le schéma numérique produit avec Maple 2019 entre le 04/12/2019 et le 09/12/2019
V = 109;
dt = 1;
l = 5;
x0 = 0;
y0 = 0;
phi0 = 0;
fd = mopen(TMPDIR+'/text.txt','wt');
mfprintf(fd,'hello %s %d.\n','world',1);
mfprintf(fd,'hello %s %d.\n','scilab',2);
for i = 0:100
//for k = 0:100
// dphi/dt = tan(0.01*t)/l
phi = (tan(0.01*i)/l)*dt + phi0;
//disp(phi)
// dx/dt = V*cos(phi)
x = V*cos(phi)*dt + x0;
//plot(i,x);
//disp(x)
// dy/dt = V*sin(phi)
y = V*sin(phi)*dt + y0;
//disp(y)
plot(x,y);//,'ro');
X = [x; y; phi];
U = [V; 0.01*i];
//disp("Etat du véhicule : ")
//disp(X)
//disp("Commande : ")
//disp(U)
/*
k = 1;
phi(i, k) = phi(i);
*/
// Linear approximation done here
A = [1 ,0 ,-V*sin(phi)*dt; 0 ,1 ,V*cos(phi)*dt; 0 ,0 ,1];
B = [cos(phi)*dt, 0; sin(phi)*dt, 0; tan(0.01*i)*dt/l, V*dt/(l*cos(0.01*i)^2)];
C = [1, 0, 0; 0, 1, 0; 0, 0, 1];
Xapp = A*X +B*U;
//plot(Xapp(1,:),Xapp(2,:),'g+-');
//disp("Etat approximé du véhicule : ")
//disp(Xapp)
Y = C*X;
//disp(Y)
//end;
mfprintf(fd,'This line is built with a column vector (26:28) %d.\n',[26:28].');
mfprintf(fd,'This line is built with a row vector (26:28) %d.\n',[26:28]);
mfprintf(fd,'This line is built with a matrix %.3f.\n',Xapp);
mfprintf(fd,'This line is built with a matrix %.3f.\n',Y);
end;
mclose(fd);
//plot(x,y,'ro');
}