mirror of
https://github.com/WallabyLester/RBF-aPID-Controller.git
synced 2026-06-02 04:47:00 +08:00
Implemented predict.
This commit is contained in:
@@ -51,3 +51,15 @@ double RBFModel::gaussian(const double* input, const double* center) {
|
|||||||
}
|
}
|
||||||
return exp(-0.5 * norm / (sigma * sigma));
|
return exp(-0.5 * norm / (sigma * sigma));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Predict the RBF output for a given input.
|
||||||
|
*/
|
||||||
|
double RBFModel::predict(const double* input) {
|
||||||
|
double output = 0.0;
|
||||||
|
for (int i = 0; i < numCenters; ++i) {
|
||||||
|
output += weights[i] * gaussian(input, centers[i]);
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user