Re: Re: FWHM, InterpolationFunction & Solve
- To: mathgroup at smc.vnet.net
- Subject: [mg80694] Re: [mg80653] Re: FWHM, InterpolationFunction & Solve
- From: Sseziwa Mukasa <mukasa at gmail.com>
- Date: Wed, 29 Aug 2007 04:15:20 -0400 (EDT)
- References: <200708220839.EAA08527@smc.vnet.net> <faj4md$8p2$1@smc.vnet.net> <200708280609.CAA14210@smc.vnet.net>
On Aug 28, 2007, at 2:09 AM, Mathieu G wrote: > Sseziwa Mukasa a =E9crit : >> On Aug 22, 2007, at 4:39 AM, Mathieu G wrote: >> >>> Hello, >>> I have a set of discrete data, representing a peak. >>> I would like to compute the Full Width at Half Maximum (FWHM) of >>> this peak. >>> For that I would like to know which points correspond to half the >>> peak value. >>> SO far I was considering using an interpolating function, but this >>> does >>> not seem to work: >>> >>> >>> DataFile = Import["FFT.dat"]; >>> CleanDataFile = Part[DataFile, 2 ;; Length[DataFile]]; >>> WorkingData = CleanDataFile[[All, {1, 3}]]; >>> >>> ListLinePlot[WorkingData, PlotRange -> All] >>> >>> MaximumFFTY = Max[WorkingData[[All, 2]]]; >>> MaximumFFTPosition = Position[WorkingData, MaximumFFTY][[1, 1]]; >>> MaximumFFTX = WorkingData[[MaximumFFTPosition, 1]]; >>> >>> DataInterpolation = Interpolation[WorkingData]; >>> >>> Solve[DataInterpolation[x] == MaximumFFTValue/2, x] >>> >>> >>> Can you help me please? How would you do that? >> >> Use FindRoot not Solve: >> >> FindRoot[DataInterpolation[x]==MaximumFFTValue/2,{x,MaximumFFTX}] >> >> But if you have a model for your signal you should fit that with >> FindFit rather than doing interpolation. At any rate this will only >> work if there is one extremum in your data. >> >> Regards, >> >> Ssezi >> > Hi! > Even though I read the documentation I still do not understand the > difference between FindRoot and Solve, can you help? Solve is essentially for solving linear systems, it also attempts to solve systems involving trigonometric, exponential and expressions. It tries to find all possible solutions to an equation which in the case of your interpolation function may be quite a large set. FindRoot just searches for the first solution found, which is not necessarily the closest, given the starting point, if you have only on peak in your data FindRoot should be able to bracket and locate the FWHM pretty quickly. Regards, Ssezi
- Follow-Ups:
- Re: Re: Re: FWHM, InterpolationFunction & Solve
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: Re: Re: FWHM, InterpolationFunction & Solve
- References:
- FWHM, InterpolationFunction & Solve
- From: Mathieu G <ellocomateo@free.fr>
- Re: FWHM, InterpolationFunction & Solve
- From: Mathieu G <ellocomateo@free.fr>
- FWHM, InterpolationFunction & Solve