Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: BUG in histc !!?
Replies: 5   Last Post: Sep 16, 2013 2:05 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 17,944
Registered: 12/7/04
Re: BUG in histc !!?
Posted: Sep 16, 2013 2:05 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply



"R " <yaelds@yahoo.com> wrote in message
news:l17b9a$col$1@newscl01ah.mathworks.com...
> Hi Penny,
>
> Thank you for your answer. It was my mistake to not see the date of the
> email, indeed an old thread. However, I did encounter a recent situation
> (last few months) where I was unable to update to a more recent version of
> Matlab (because the Apple computer could not in turn update to a newer
> OS). The result is that I am now stuck with a Matlab version that cannot
> run TriScatteredInterp on my data because of a bug -- something about not
> being able to handle NaNs. I did contact customer support and they
> mentioned there was no fix for this other than upgrading my Matlab version
> which I can't. (Well they did suggest using zeros or some other
> place-holder but interpolating a zero value is not the same as ignoring a
> NaN value. I could use a ridiculously high value so I can reject high
> values in the interpolated field, but I would be loosing data that way. I
> would rather interpolate from the good values while ignoring the NaN
> ones.)


*snip*

I'll let Penny address your suggestion about backporting and focus on
handling NaN values in the data (not coordinates) used by
TriScatteredInterp. You said that you would "rather interpolate from the
good values while ignoring the NaN ones." If the NaNs are in the data inputs
to TriScatteredInterp and not the coordinate inputs, an easy way to do that
is using a mask:

x = rand(100,1)*4-2;
y = rand(100,1)*4-2;
z = x.*exp(-x.^2-y.^2);

% Introduce a NaN
zz = z; zz(1) = NaN;

% Create the mask
finiteonly = isfinite(zz);

% Use just the "good" data
F = TriScatteredInterp(x(finiteonly), y(finiteonly), zz(finiteonly));

% Check and see how it did
differenceShouldBeSmall = F(x(1), y(1)) - z(1)

*snip*

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.