[Ex1 - Q3] Ajout

This commit is contained in:
Lyanis SOUIDI 2023-05-18 17:47:07 +02:00
parent 16d08a4592
commit 349e35266a
Signed by: Lyanis SOUIDI
GPG Key ID: 251ADD56CFE6A854
3 changed files with 20 additions and 0 deletions

View File

@ -69,3 +69,13 @@ densiteOceanie = populationOceanie / surfaceOceanie;
- Asie : 140.97 habitants/km²
- Europe : 32.28 habitants/km²
- Océanie : 4.76 habitants/km²
## Question 3
> Représenter la densité moyenne dhabitants au km2 pour chaque continent en utilisant un diagramme en bâtons (on mettra en abscisse des entiers de 1 à 6).
**[Script Scilab](resources/scripts/ex1-3.sce) :**
```scilab
bar([densiteAfrique, densiteAmeriqueDuNord, densiteAmeriqueDuSud, densiteAsie, densiteEurope, densiteOceanie]);
```
**Résultat :**
![Diagramme en bâtons](resources/img/ex1-3.png)

BIN
resources/img/ex1-3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -0,0 +1,10 @@
data = csvRead("resources/data/data.csv");
densiteAfrique = sum(data(1:57, 3)* 1000000) / sum(data(1:57, 2)* 1000);
densiteAmeriqueDuNord = sum(data(58:86, 3)* 1000000) / sum(data(58:86, 2)* 1000);
densiteAmeriqueDuSud = sum(data(87:99, 3)* 1000000) / sum(data(87:99, 2)* 1000);
densiteAsie = sum(data(100:150, 3)* 1000000) / sum(data(100:150, 2)* 1000);
densiteEurope = sum(data(151:193, 3)* 1000000) / sum(data(151:193, 2)* 1000);
densiteOceanie = sum(data(194:207, 3)* 1000000) / sum(data(194:207, 2)* 1000);
bar([densiteAfrique, densiteAmeriqueDuNord, densiteAmeriqueDuSud, densiteAsie, densiteEurope, densiteOceanie]);