Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double std_div(vector<int>& vec, double mean)
- {
- vector<double> holder;
- double holder_sum;
- double holder_div;
- double standard_div;
- //squares the value minus the mean
- for(int x=0; x < vec.size(); x++)
- {
- holder[x] = pow((vec[x] - mean), 2);
- cout << holder[x] << endl;
- }
- //sum of new vector
- for(int x=0; x < holder.size(); x++)
- {
- holder_sum += holder[x];
- }
- holder_div = holder_sum/holder.size();
- standard_div = sqrt(holder_div);
- return standard_div;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement