dphfwzn8269 2019-02-21 17:17
浏览 125

检查功能点的位置


I have a points and I want to draw a best fit hyperbolic function for this points.
Now I want to make a Quality checker. Any ideas?
My idea was to check where is the point against the function. ( Like if the point is over / under or on the function )
prescription function is : fn(x)=A1+(A2/A3*(x+A4))
My first idea for this was:

function checkQuality($points,$m,$k,$A1,$A4){
    $over = 0;
    $under= 0;
    $on = 0;
    $radius = 3;

    foreach ($points as $point){
        $status = ($A1+($m/($k*($point['x']+$A4)))-$point['y']);
        if($status < $radius && $status > -$radius){
            $status = 0;
        }
        if($status > 0){
            $over++;
        }else if($status <1 && $status >= 0){
            $on++;
        }else if($status < 0){
            $under++;

        }
    }
    if($under < $over){
        $percentChange = ($under !== 0 ? ($under / $over) : 0) * 100;
    }else{
        $percentChange = ($over !== 0 ? ($over / $under) : 0) * 100;
    }

    return ['on'=>$on,'over'=>$over,'under'=>$under,'percent'=>$percentChange];
}

But the result is not so accurate.

Here I post how its look like. The green curve is manualy set and the blue one is generated ( Where I'm using the quality check for check how is good and if is bad try generate better curve ) -> the Green curve is better than the blue

Graph screen

(The values in the inputs are for green curve)


here is code where I'm using the Quality check for imagine why I want to have the most possible accurate checker:

  for($i = 0; $i < 10000 ; $i++){
        $new_m += 0.2;
        $actual = $this->checkQuality($points['points'],$new_m,$ob['k'],0,0);
        if($actual['percent'] > $prev['percent']){
            $prev['percent'] = $actual['percent'];
            $prev['m'] = $new_m;
            $newQuality = $actual;
        }else if($i>0 && $actual['percent'] < $prev['percent']){
            break;
        }
    }
  • 写回答

0条回答 默认 最新

    报告相同问题?