Dans une application de calcul d'enceintes et haut-parleur, je souhaite afficher le graphe de la courbe de réponse.
Calculs et graphe sont réalisés en php

Il y a deux programmes :
Le premier calcule la courbe de réponse, avec un couple de valeur, Frequence sur X, $dbabr sur Y.
Le deuxième calcule l'image pour l'afficher dans le premier programme.Je tiens particulièrement à l'affichage dans le premier programme.

Le problème se trouve dans le passage des paramètres entre les programmes.
Le GET utilisé fonctionne, mais je suis limité dans le nombre de valeurs qui peuvent être passées.

Premier programme :
Les fonctions sont à l'adresse http://www.petoindominique.fr/ à la place de ../
Le pas de calcul est le 1/12e d'octave, $f = $f*pow(2,1/12) ; à cause de la limitation du nombre de valeurs qui passent

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
<?php
include("../mysql_s/fonction_br.php");
include("../mysql_s/fonction_room_gain.php");
 
//Valeurs par défaut
$fs = 25;
$fb = 30;
$fb_aff = number_format($fb, 1, '.', '') ;
$vas = 65;
$volbr = 50;
$volbr_aff = number_format($volbr, 1, '.', '') ;
$qb = 6.7;
$qts = 0.31;
$froomgain = 50;
$proomgain = 0;
$sens_aff = 92.2;
 
// boucle de calcul
$f = 10;
$tension = sqrt(8) ;
$i = 0;
$dbabr=array();
while ($f <= 320)
{
$dbabr[$i][1] = reponse($f, $fs, $fb, $vas, $volbr, $qb, $qts, $froomgain, $proomgain) ;
$dbabr[$i][0] = $f;
$f = $f*pow(2,1/12) ;
$i++;
}
?>
 
<p align="center"><font face="Arial" size="2"><b>Courbe de réponse du
<?php echo "$marque"; ?> <?php echo "$reference"; ?>, VB = <?php echo "$volbr_aff"; ?> L, FB = <?php echo "$fb_aff"; ?> Hz, le 0 dB correspond à <?php echo "$sens_aff"; ?> dB/2.83V/m.</b></font></p>
<p align="center">
<img src="../mysql_s/graph_test.php?dbabr=<?php echo serialize($dbabr); ?> alt="courbe de réponse bass-reflex"></p>
<p align="center"><font face="Arial" size="2">Tracé en 1/12<sup>e</sup> d'octave.</font></p>
Calcul de l'image : graph_test.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
 
<?php
 
$dbabr = unserialize($_GET['dbabr']);
 
$limsupy = 10;
$liminfy = -15;
$pasy = $limsupy-$liminfy;
 
$largeur = 800;
$hauteur = 400;
$originex = $largeur/20;
$originey = $hauteur/20;
$largeurx = $largeur-$originex;
$hauteury = $hauteur-$originey;
 
$image = imagecreate($largeur, $hauteur);
$fond = imagecolorallocate($image, 220, 220, 220);
$trait = imagecolorallocate($image, 32, 32, 32);
$rouge = imagecolorallocate($image, 255, 0, 0);
$vert = imagecolorallocate($image, 0, 255, 0);
$bleu = imagecolorallocate($image, 0, 0, 255);
$gris = imagecolorallocate($image, 160, 160, 160);
$noir = imagecolorallocate($image, 0, 0, 0);
 
//Echelle
$octavex = log10(320/10)/log10(2);
$echellex = ($largeurx-$originex)/$octavex;
$zeroy = ($hauteury-$originey)/$pasy*$limsupy+$originey;
$echelley = ($hauteury-$originey)/$pasy;
 
//Traits verticaux normalisés
$p1xaff = log10(10/10)/log10(2)*$echellex+$originex;
imageline( $image, $p1xaff, $originey, $p1xaff, $hauteury, $noir);
imagestring( $image, 3, $p1xaff, 8, "10", $noir);
$p1xaff = log10(15/10)/log10(2)*$echellex+$originex;
imageline( $image, $p1xaff, $originey, $p1xaff, $hauteury, $gris);
$p1xaff = log10(20/10)/log10(2)*$echellex+$originex;
imageline( $image, $p1xaff, $originey, $p1xaff, $hauteury, $noir);
imagestring( $image, 3, $p1xaff, 8, "20", $noir);
imagestring( $image, 3, $p1xaff, 3+$hauteury, "20", $noir);
$p1xaff = log10(30/10)/log10(2)*$echellex+$originex;
imageline( $image, $p1xaff, $originey, $p1xaff, $hauteury, $gris);
$p1xaff = log10(40/10)/log10(2)*$echellex+$originex;
imageline( $image, $p1xaff, $originey, $p1xaff, $hauteury, $gris);
$p1xaff = log10(50/10)/log10(2)*$echellex+$originex;
imageline( $image, $p1xaff, $originey, $p1xaff, $hauteury, $noir);
imagestring( $image, 3, $p1xaff, 8, "50", $noir);
imagestring( $image, 3, $p1xaff, 3+$hauteury, "50", $noir);
$p1xaff = log10(60/10)/log10(2)*$echellex+$originex;
imageline( $image, $p1xaff, $originey, $p1xaff, $hauteury, $gris);
$p1xaff = log10(70/10)/log10(2)*$echellex+$originex;
imageline( $image, $p1xaff, $originey, $p1xaff, $hauteury, $gris);
$p1xaff = log10(80/10)/log10(2)*$echellex+$originex;
imageline( $image, $p1xaff, $originey, $p1xaff, $hauteury, $gris);
$p1xaff = log10(90/10)/log10(2)*$echellex+$originex;
imageline( $image, $p1xaff, $originey, $p1xaff, $hauteury, $gris);
$p1xaff = log10(100/10)/log10(2)*$echellex+$originex;
imageline( $image, $p1xaff, $originey, $p1xaff, $hauteury, $noir);
imagestring( $image, 3, $p1xaff, 8, "100", $noir);
imagestring( $image, 3, $p1xaff, 3+$hauteury, "100", $noir);
$p1xaff = log10(150/10)/log10(2)*$echellex+$originex;
imageline( $image, $p1xaff, $originey, $p1xaff, $hauteury, $gris);
$p1xaff = log10(200/10)/log10(2)*$echellex+$originex;
imageline( $image, $p1xaff, $originey, $p1xaff, $hauteury, $noir);
imagestring( $image, 3, $p1xaff, 8, "200", $noir);
imagestring( $image, 3, $p1xaff, 3+$hauteury, "200", $noir);
$p1xaff = log10(300/10)/log10(2)*$echellex+$originex;
imageline( $image, $p1xaff, $originey, $p1xaff, $hauteury, $gris);
imagestring( $image, 3, $p1xaff, 8, "Hz", $noir);
imagestring( $image, 3, $p1xaff, 3+$hauteury, "Hz", $noir);
 
//traits horizontaux
$dbdebut = $limsupy;
$pash = ($originey-$hauteury)/$pasy;
$i = 0;
$db = $dbdebut;
while ($i <= $pasy)
{
if ($db == 10 or $db == 5 or $db == 0 or $db == -5 or $db == -10 or $db == -15)
{
  imageline( $image, $originex, $originey-$i*$pash, $largeurx, $originey-$i*$pash, $noir);
  if ($db <> 0)
  {
  imagestring( $image, 3, $originex-22, $originey-$i*$pash-5, $db, $noir);
  }
  else
  {
  imagestring( $image, 3, $originex-33, $originey-$i*$pash-5, "0 dB", $noir);
  imagestring( $image, 3, $largeurx+5, $originey-$i*$pash-5, "0 dB", $noir);
  }
}
else
{
  imageline( $image, $originex, $originey-$i*$pash, $largeurx, $originey-$i*$pash, $gris);	
}
$i++;
$db = $db-1;
}
 
//Courbe de réponse
$i = 0;
while($i<59)
{
	$p1x = $dbabr[$i][0];
	$p1y = $dbabr[$i][1];
	$room1 = $dbabr[$i][2];
	$champs1 = $room1+$p1y;
	$p2x = $dbabr[$i+1][0];
	$p2y = $dbabr[$i+1][1];
	$room2 = $dbabr[$i+1][2];
	$champs2 = $room2+$p2y;
	$p1xaff = log10($p1x/10)/log10(2)*$echellex+$originex;
	$p2xaff = log10($p2x/10)/log10(2)*$echellex+$originex;
	$room1aff = log10($room1/10)/log10(2)*$echellex+$originex;
	$room2aff = log10($room2/10)/log10(2)*$echellex+$originex;
	$champs1aff = log10($champs1/10)/log10(2)*$echellex+$originex;
	$champs2aff = log10($champs2/10)/log10(2)*$echellex+$originex;
	$p1yaff = $zeroy-$p1y*$echelley;
	$p2yaff = $zeroy-$p2y*$echelley;
	imageline( $image, $p1xaff, $p1yaff, $p2xaff, $p2yaff, $rouge);
//	imageline( $image, $room1aff, $p1yaff, $room2aff, $p2yaff, $vert);
//	imageline( $image, $champs1aff, $p1yaff, $champs2aff, $p2yaff, $bleu);
	$i++;
}
 
 
 
header("content-type: image/png");
imagepng($image);
imagedestroy($image);
?>
Merci a ceux qui pourront m'aider.

dp