Php 带JPG图的高斯图
我正在尝试用php绘制高斯图。我找到了jpgraph库,但我不知道如何使用Php 带JPG图的高斯图,php,jpgraph,Php,Jpgraph,我正在尝试用php绘制高斯图。我找到了jpgraph库,但我不知道如何使用$x,$y数据。请那些知道如何申报轴心国的人。谢谢这是我的代码: while ($row = pg_fetch_assoc($sql)) { $ydata = array(); $xdata = array(); $ydata[] = abs(($row['grade']-$miu)/$sigma); $xdata[] = 0; for ($i = 0; $i <= 60; $
$x
,$y
数据。请那些知道如何申报轴心国的人。谢谢这是我的代码:
while ($row = pg_fetch_assoc($sql))
{
$ydata = array();
$xdata = array();
$ydata[] = abs(($row['grade']-$miu)/$sigma);
$xdata[] = 0;
for ($i = 0; $i <= 60; $i+=10) // put z value
{
$xdata[] = 0 + $i;
$ydata[] = 0 + $i;
}
$graph = new Graph(600,400,"auto");
$graph->SetScale("linlin");
$lplot = new LinePlot($ydata,$xdata);
$lplot->SetColor("blue");
$lplot->SetWeight(2);
$graph->Add($lplot);
// Add data to X coordinate
$graph->xaxis->SetTickLabels($xdata);
// Display the graph
$graph->Stroke();
}
while($row=pg\u fetch\u assoc($sql))
{
$ydata=array();
$xdata=array();
$ydata[]=abs($row['grade']-$miu)/$sigma);
$xdata[]=0;
对于($i=0;$i设置刻度(“linlin”);
$lplot=新的线形图($ydata,$xdata);
$lplot->SetColor(“蓝色”);
$lplot->SetWeight(2);
$graph->Add($lplot);
//将数据添加到X坐标
$graph->xaxis->SetTickLabels($xdata);
//显示图形
$graph->Stroke();
}
我已经解决了
while ($row = pg_fetch_assoc($sql))
{
$z[$i] = ($row['grade'] - $miu)/$sigma; // $z => arreglo con notas normalizadas
$ordenada[$i] = (1/($sigma*sqrt(pi())))*(exp(-0.5*(($row['grade']-$miu)*($row['grade'] - 57))/(12*12)));
$i++;
}
//rest of code
$p1 = new LinePlot($ordenada);
$graph->Add($p1);