Pour ceux qui serait intéressé :
Lancement du programme de calcul de l'image :
Calcul de l'image du déplacement, après simplification de la partie calcul par rapport à hier :
L'intérêt du PHP est qu'une fois la mise à jour faite sur le serveur, tout le monde en profite sans avoir à installer une nouvelle version...
J'ai une question précise pour Jean-Marc :
Il faut utiliser :
QL compris entre 10 et 20, 10 dans votre exemple.
ou
QB = 1/(1/QA+1/QL+1/QP+1/QA/QL/QP) (en pratique 7 environ).
Lancement du programme de calcul de l'image :
Code :
<?php
$mma=array();
$mma[0] = floatval($fsb);
$mma[1] = floatval($fb);
$mma[2] = floatval($vas);
$mma[3] = floatval($volbr);
$mma[4] = floatval($qb);
$mma[5] = floatval($qtsb);
$mma[6] = floatval($vmax_aff);
$mma[7] = floatval($qesb);
$mma[8] = floatval($bl);
?>
<p> </p>
<div class="centrer">
<p class="gras">Courbe de déplacement de la membrane du <?php echo "$marque"; ?> <?php echo "$reference"; ?>, V<sub>B</sub> = <?php echo "$volbr_aff"; ?> L, F<sub>B</sub> = <?php echo "$fb_aff"; ?> Hz,
à <?php echo "$vmax_aff"; ?> V.</p>
</div>
<div class="image-centrer">
<img src="../mysql_s/graph_br_mm.php?mma=<?php echo serialize($mma); ?>" alt="courbe de déplacement de la membrane bass-reflex"><br>
</div>
<div class="centrer">
<p>Modification des équations de calculs de la courbe de déplacement de la membrane le 26/06/2022, avec l'aide active de JMP.</p>
</div>
Calcul de l'image du déplacement, après simplification de la partie calcul par rapport à hier :
Code :
<?php
//Passage des valeurs de base
$mma = unserialize($_GET['mma']);
$fs = $mma[0];
$fb = $mma[1];
$vas = $mma[2];
$volbr = $mma[3];
$qb = $mma[4];
$qts = $mma[5];
$tension = $mma[6];
$qes = $mma[7];
$bl = $mma[8];
$limsupy = 20;
$liminfy = 0;
$pasy = $limsupy-$liminfy;
$largeur = 800;
$hauteur = 400;
$originex = $largeur/20;
$originey = $hauteur/20;
$largeurx = $largeur-$originex;
$hauteury = $hauteur-$originey;
$nboctave = 5;
$pointoctave = ($largeur-2*$originex)/1/$nboctave;
$image = imagecreate($largeur, $hauteur);
$fond = imagecolorallocate($image, 220, 220, 220);
$trait = imagecolorallocate($image, 32, 32, 32);
$rouge = imagecolorallocate($image, 255, 0, 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;
$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);
imagestring( $image, 3, $p1xaff, 3+$hauteury, "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
$mmdebut = $limsupy;
$pash = ($originey-$hauteury)/$pasy;
$i = 0;
$mm = $mmdebut;
while ($i <= $pasy)
{
if ($mm == 30 or $mm == 25 or $mm == 20 or $mm == 15 or $mm == 10 or $mm == 5 or $mm == 0)
{
imageline( $image, $originex, $originey-$i*$pash, $largeurx, $originey-$i*$pash, $noir);
if ($mm <> 5)
{
imagestring( $image, 3, $originex-22, $originey-$i*$pash-5, $mm, $noir);
}
else
{
imagestring( $image, 3, $originex-33, $originey-$i*$pash-5, "5 mm", $noir);
imagestring( $image, 3, $largeurx+5, $originey-$i*$pash-5, "5 mm", $noir);
}
}
else
{
imageline( $image, $originex, $originey-$i*$pash, $largeurx, $originey-$i*$pash, $gris);
}
$i++;
$mm = $mm-1;
}
$f = 10;
// Courbe de déplacement JMP
$h = $fb/$fs ;
$a = $vas/$volbr ;
$fo = sqrt($fs/$fb) ;
$a1 = 1/$qb/sqrt($h)+sqrt($h)/$qts ;
$a2 = ($a+1)/$h+$h+1/$qb/$qts ;
$a3 = 1/$qts/sqrt($h)+sqrt($h)/$qb ;
$p1x = $f;
$f = $f*pow(2,1/$pointoctave) ;
$i = 0;
while($f <= 320)
{
// Courbe de déplacement JMP
$com = $tension*sqrt(2)/$bl/2/M_PI/$fs/$qes ;
$num = sqrt(pow(1-pow($f/$fb,2),2)+pow(1/$qb*$f/$fb,2)) ;
$denom = sqrt(pow((1-$a2*pow($f/$fo,2)+pow($f/$fo,4)),2)+pow(($a1*($f/$fo)-$a3*pow($f/$fo,3)),2)) ;
$p2y = 1000000000*$com*$num/$denom ;
$p2x = $f;
$p1xaff = log10($p1x/10)/log10(2)*$echellex+$originex;
$p2xaff = log10($p2x/10)/log10(2)*$echellex+$originex;
$p1yaff = $zeroy-$p1y*$echelley;
$p2yaff = $zeroy-$p2y*$echelley;
if ($i > 1){imageline( $image, $p1xaff, $p1yaff, $p2xaff, $p2yaff, $rouge);}
$p1x = $p2x;
$p1y = $p2y;
$f = $f*pow(2,1/$pointoctave) ;
$i = $i+1;
}
header("content-type: image/png");
imagepng($image);
imagedestroy($image);
?>
L'intérêt du PHP est qu'une fois la mise à jour faite sur le serveur, tout le monde en profite sans avoir à installer une nouvelle version...
J'ai une question précise pour Jean-Marc :
Il faut utiliser :
QL compris entre 10 et 20, 10 dans votre exemple.
ou
QB = 1/(1/QA+1/QL+1/QP+1/QA/QL/QP) (en pratique 7 environ).