ons, 15 07 2009 kl. 14:18 +0200, skrev Petr Mikulik:
> Well, the routine works on data, not on functions. Consider an experiment 
> with measured 100 data sets put columnwise into a matrix y. Then max(y), 
> min(y), mean(y), std(y), etc. give statistics for each data set at one call.
> Therefore fwhm(y) should behave the same.

I agree with this. These kind of API's are very helpful for writing
vectorised code.

> I'm enclosing an update for my previous routine fwhm.m that does work on 
> matrix data, works on both potential definitions of fwhm, and passes all of 
> the accompanying tests. I consider this being general and powerful enough 
> for being enclosed into an octave's package.

I am not knowledgeable enough to be able to decide which of the two
competing implementations are better. Looking at the code, I get the
impression that Petr's version is more stable, but I would appreciate it
if somebody else could make the decision.

Petr, I have a few comments on your code:

    if ~isstr(opt)
        error('opt must be "zero" or "min"');
    end
    if ~(strcmp(opt, 'zero') || strcmp(opt, 'min'))
        error('opt must be "zero" or "min"');
    end

Shouldn't that just be

    if ~isstr(opt) || ~(strcmp(opt, 'zero') || strcmp(opt, 'min'))
        error('opt must be "zero" or "min"');
    end

? Also, in Octave you should be able to use 'strcmp (opt, {'zero',
'min'})', but I don't know if that works in Matlab.

You have some code that is removed using

    if 0
        ...

This should probably be changed into a comment.

Søren


------------------------------------------------------------------------------
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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to