I have read similar questions about finding peaks on the web (Finding peaks of data) as well as the FindPeaks function but I'm struggling to put them into proper context for my case. I am still a new user so forgive me if my question is too trivial, but my issue is of the following:
ClearAll["Global'*"];
f[ω_, κ2_,x_] := (384000.` x κ2 Sqrt[κ2^2])/(1600000000 x^2 \
κ2^2 (1/100000000 + 4 ω^2) + (κ2^2 +
4 ω^2) (16 +
8 (1/10000 - 4 ω^2) + (1/100000000 +
4 ω^2) (1 + 4 ω^2)) +
80000 x κ2 ((κ2 - 4 ω^2) (1/100000000 +
4 ω^2) +
4 (κ2/10000 + 4 ω^2))) + (9.6` (κ2^2 +
4 ω^2))/(1600000000 x^2 κ2^2 (1/100000000 +
4 ω^2) + (κ2^2 + 4 ω^2) (16 +
8 (1/10000 - 4 ω^2) + (1/100000000 +
4 ω^2) (1 + 4 ω^2)) +
80000 x κ2 ((κ2 - 4 ω^2) (1/100000000 +
4 ω^2) +
4 (κ2/10000 +
4 ω^2))) + (0.0122` (1600000000 x^2 κ2^2 +
80000 x κ2 (κ2 - 4 ω^2) + (1 +
4 ω^2) (κ2^2 +
4 ω^2)))/(1600000000 x^2 κ2^2 (1/100000000 +
4 ω^2) + (κ2^2 + 4 ω^2) (16 +
8 (1/10000 - 4 ω^2) + (1/100000000 +
4 ω^2) (1 + 4 ω^2)) +
80000 x κ2 ((κ2 - 4 ω^2) (1/100000000 +
4 ω^2) + 4 (κ2/10000 + 4 ω^2)))
Here I basically have a reduced (ironically long) function that is dependent on the parameters κ2 and x. If I plot f with the following parameters:
Plot[f[ω, 100, 10^-6], {ω, -5, 5}]
I get a curve with two peaks which is all good. However, depending on the parameters of κ2 and x, the number of peaks might change from 2 to 1 (you can try this out but later on this). I wish to find the peaks for these two points but I am unable to extract a list for the x-axis (ω in this case) for me to use FindPeaks. However, since I know the range for the x values, I could do:
k = {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5}
FindPeaks[f[k, 100, 10^-6]]
And it would pick out the position of the peaks and it's corresponding peak values. However, this method is extremely impractical given that the peak position (which are dependent on the parameters) need not necessarily be integers. My question is: Is there a way to extract my x-axis as a list and feed it into my FindPeaks function?
I also have looked into the FindMaximum function but unfortunately the function only spits out one peak, and depending on where I start my point with, it searches for only the nearest peak:
FindMaximum[f[ω, 100, 10^-6], {ω, 2}]
FindMaximum[f[ω, 100, 10^-6], {ω, -2}]
Moreover, this is a presumptuous and impractical method since this is assuming that I know where the peaks will lie around (i.e 2 in this case) and that's not necessarily the case should I vary my parameters over a wide range of values.
For those who are curious on why I want to do this, I am intending to loop over a range of values for both parameters (κ2 and x) and find the difference in peak position values for my function f. Depending on the parameters, f might produce one or two peaks.
Sorry for the lengthy post and I'd take any help I can get. Thank you in advance!