The function will not work if there is many impulsion (maximum) in the vector imput.
To be honest, I didn't know that cosinus had a fwhm. I just code that function for my own use and share it. I will not improve this to work on every mathematical function it already exist. I haven't enought knowledge in math or coding. I only work with impulsion defined from 0 to maximum, it's only a single maximum, not even another impulsion with a lower maximum. I know that with many others shapes it will not work. That's why I wanted the code to return 0 and print a warning when the function would not be able to find a fwhm.
But I think you're right about one thing, the fwhm is defined by half the value between the min and the max. I can't modify it because I haven't the last version of my own function. I have a version for my own use wich is quite different from the version you use (because you have added many test and feature that I don't care for my use and in addition, I want for my use, to have a warning and not an error, so I deleted the public version in my folder

)
If you can send me the last version or modify by your own, thank you. I think you juste have to replace 0 by min(f) but I don't have the code in mind.
Regards,
christophe
PS : I don't think it would work for matrix, and however, I don't know how make it works.
Le lundi 13 juillet 2009 à 12:01 +0200, Petr Mikulik a écrit :
> > Ok, I think it's good now :)
>
> Thanks. Since nobody has commented, I assume people think your stuff is
> good :-)
>
> I've (hopefully) made the documentation somewhat more clear, and changed
> the coding-style a bit. Could you check that I haven't broken anything?
> I'm attaching the code.
I've tried it now, and I think the code is buggy:
A.
x=-pi:0.01:pi; y=cos(x);
plot(x,y)
fwhm(x,y)
=> FWHM is pi, but the script returns 2.094
B.
x=-pi:0.01:pi; y=cos(x) + 5;
plot(x,y)
fwhm(x,y)
=> FWHM is pi, but the script says "full width at half maximum is not
=> defined.".
It looks like the script works not between min and max values of the curve
(x,y), but between max(y) and zero. That's wrong and contrary to its
documentation.
I think that "#!test" case should be added.
Further, could it produce vector of fwhm's for matricial f in fwhm(x,f)?
Greetings,
Petr
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at:
http://p.sf.net/sfu/Challenge_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev