Finding Peak

Hello everyone,

I am trying to find a peak of an IV-curve. I figured out that I should use "findpeak" command to find the peak of this curve by calling that particular wave.
But I am still having some problems with it on how to use this command and stuff.
Please help me.
I also tried the following code:

assignment="Duplicate /O IG"+iname+" IGTEMP"; execute assignment

Wave/D IGTEMP

findpeak/N IGTEMP
Wavestats IGTMEP
variable VPeakVal=V_PeakVal
variable x=IGTEMP[VPeakVal]

//putting data into the desired wave
wave[wavenumber]=x

//killing sacrifical waves
killwaves IGTEMP

"IG" is wave loaded, and "wave" is the wave data will be stored in.
alinawaz87 wrote:
I also tried the following code:
assignment="Duplicate /O IG"+iname+" IGTEMP"; execute assignment

Wave/D IGTEMP

findpeak/N IGTEMP
Wavestats IGTMEP
variable VPeakVal=V_PeakVal
variable x=IGTEMP[VPeakVal]

//putting data into the desired wave
wave[wavenumber]=x

//killing sacrifical waves
killwaves IGTEMP

"IG" is wave loaded, and "wave" is the wave data will be stored in.


This may not be your only problem, but I don't think the following line is doing what you want it to:
variable x=IGTEMP[VPeakVal]


I suspect that you are trying to assign the Y (data) value at the peak location to variable x. However VPeakVal itself is the Y value at the peak. Your wave IG may or may not have a point whose index is VPeakVal. Especially since VPeakVal is likely to not be an integer value, and since wave point indexes are always integer values. So I think that you either want to do:
Variable x = IGTEMP[V_PeakLoc]
wave[wavenumber] = x


or

wave[wavenumber]=V_PeakVal


The two options should produce the same result but the second one is faster and makes the code simpler.