// multispeed.cpp: C++ program to estimate rotor speed for experiments with // multiple speed steps when the sample is heterogeneous. Written in standard C++ // This program can be compiled with gcc: // g++ multispeed.cpp #include #include #include using namespace std; int next_rpm (int); double calc_time(int, double); double calc_b (double, int, double); double omega_s (int); double m, meniscus=5.9, b=7.2, largest_s=4e-12; int first_speed=6000, rotor_max=50000; int main (int argc, char *argv[]) { char str; if (argc == 1) { cout << "\nAssuming meniscus=5.9 cm, maximum sed. coeff=40e-13 s,\n"; cout << "lowest speed=6,000 rpm, maximum speed=50,000 rpm.\n"; cout << "\nYou can also specify your own values on the command line:\n"; cout << "Usage: ./a.out \n"; cout << "\nHit enter to continue...\n"; cin.get(); } else if (argc != 1 && argc <= 4) { cout << "Usage: ./a.out \n"; } else { meniscus = atof(argv[1]); largest_s = atof(argv[2]); first_speed= atof(argv[3]); rotor_max = atof(argv[4]); } double tmp; vector > position; vector t; vector s; vector rpm; int i=0, j=0, k; rpm.clear(); rpm.push_back(first_speed); s.push_back(largest_s); t.clear(); vector pos; pos.clear(); // set up vector of rpm values: cout << "\nRotor speeds:\n"; while (rpm[i] <= rotor_max) { cout << "rpm[" << i << "]: " << rpm[i] << endl; rpm.push_back(next_rpm(rpm[i])); i++; pos.push_back(meniscus); // all species start at meniscus } position.push_back(pos); cout << "\nS values:\n"; cout << "s[" << 0 << "]: " << s[0] << endl; for (j=1; jrpm.size()-1) break; } cout << "Times for each speed:\n\n"; for (i=0; i