fit_p function

Step 3: Optimizing parameters to fit real data