From: dpb on
Jane wrote:
> forget it i will try and read a book about it

I think the biggest problem is you don't seem to have a clear enough
description of the problem you're trying to solve (or at least you're
not providing it if you do).

If this is still related to the earlier allusion to a 3D function, then
you need data in the 3D space from which to interpolate and interp1
probably isn't what you want.

interp3 and meshgrid may be more on the lines of what you're looking for
in that case, but the size of the arrays you've asked for may create
some memory problems if expanded in 3D.

--
From: Jane on
dpb <none(a)non.net> wrote in message <hl9uqp$sci$1(a)news.eternal-september.org>...
> Jane wrote:
> > forget it i will try and read a book about it
>
> I think the biggest problem is you don't seem to have a clear enough
> description of the problem you're trying to solve (or at least you're
> not providing it if you do).
>
> If this is still related to the earlier allusion to a 3D function, then
> you need data in the 3D space from which to interpolate and interp1
> probably isn't what you want.
>
> interp3 and meshgrid may be more on the lines of what you're looking for
> in that case, but the size of the arrays you've asked for may create
> some memory problems if expanded in 3D.
>
> --

It is X Y Z in 3d. I read in somebody elses post that I could perform interp1 to interpolate X with Y and X with Z?

What I am unclear is. For example. Early post shows a sin wave going from left to right interpolating it to equal 1000 instead of a smaller value. This is understood to me but what if there is a sin wave going up in the Y axis so that it looks like a snake so that 2 or more X values would be the same? How does interp1 distinguish. I am not clear about interpolation yet because I have just started to read. Would this come under Beizer curve.
From: dpb on
Jane wrote:
> dpb <none(a)non.net> wrote in message
> <hl9uqp$sci$1(a)news.eternal-september.org>...
>> Jane wrote:
>> > forget it i will try and read a book about it
>>
>> I think the biggest problem is you don't seem to have a clear enough
>> description of the problem you're trying to solve (or at least you're
>> not providing it if you do).
>>
>> If this is still related to the earlier allusion to a 3D function,
>> then you need data in the 3D space from which to interpolate and
>> interp1 probably isn't what you want.
>>
>> interp3 and meshgrid may be more on the lines of what you're looking
>> for in that case, but the size of the arrays you've asked for may
>> create some memory problems if expanded in 3D.
>>
>> --
>
> It is X Y Z in 3d. I read in somebody elses post that I could perform
> interp1 to interpolate X with Y and X with Z?

Well, if you ignore the other dimensions concurrently, sure...

> What I am unclear is. For example. Early post shows a sin wave going
> from left to right interpolating it to equal 1000 instead of a smaller
> value. This is understood to me but what if there is a sin wave going up
> in the Y axis so that it looks like a snake so that 2 or more X values
> would be the same? How does interp1 distinguish. I am not clear about
> interpolation yet because I have just started to read. Would this come
> under Beizer curve.

In that case the independent variable would be the vertical. interp1
requires a monotonic independent variable. If this weren't the case
you'd have to have piecewise independent interpolating functions or some
other way to determine where in the curve you were, correct. This
requirement is basically one required for specificity regardless of the
interpolation method.

--
From: Julian on
John, Ade,
Thank you for your quick responses, and forgive me for my tardiness. I found a solution to my problem.

In a nutshell, my inquiry was towards the output I was getting when implimenting the interp1 function. I was not to sure if what I was getting was exactly correct. I had two files of data which I had told matlab to read in within some indices restraints, and output three variables (time1, time2, point1) while interpolating time1. e.g. I was using test_interp = interp1(time1, point1) thinking that this would interpolate correctly. What I was actually doing was interpolating time2 (in my previous example) instead of interpolating time1, which produced a "wrong" graph. what I needed to do was say test_interp = interp1(time1, point1, time2). This produced the correct graph.

Thank you very much for your help.



"John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <hkrk8s$ont$1(a)fred.mathworks.com>...
> "Julian " <sadsd(a)aol.com> wrote in message <hkppec$cs5$1(a)fred.mathworks.com>...
> > Good afternoon matlab community,
> > I have a hopefully, "easy" question I need answering. Currently, I am writing a script that reads in two files using textread, compares the values and points, then interpolates. I did a quick script and it produced "something" but i'm not sure if it's necessarily right. So I was thinking of doing a manual function for interpolate rather than use the interp1 function. Anyone know if matlab's interp1 function correctly interpolates two files of given data each?
> >
> > Thanks.
>
> Yes, interp1 correctly interpolates anything that you
> give it, under certain conditions. If you pass in
> garbage, you get garbage out.
>
> We have no idea exactly what you are passing in
> from your description though, so it is difficult to
> be more accurate.
>
> John
From: Travis on
OK here are the variables used.

temp = 29.6 29.4 28.5 28.1 28.5
25.3 23.7 23.50 24.7 24.4
24.2 21.9 21.8 23.8 23.4
23.1 20.8 20.9 23 22.4
22.3 20.2 20.1 22.2 21.8
22 19.85 20.05 21.7 21.6
NaN 19.5 20 21.2 NaN
NaN 19.9 NaN NaN NaN

dist = 6 12 18 24 30
depth = 0
-1
-2
-3
-4
-4.50000000000000
-5
-6

Dist = min(dist):1:max(dist);
Depth = min(depth):0.5:max(depth)';
TEMP = interp2(dist,depth,temp,Dist,Depth,'spline');

The original data points are not always held.
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5
Prev: nntool
Next: spatial data and neural networks