From: Asghar on
Hi guys,

I've plotted a graph from some values ending at x =10 000.. Now i need to extrapolate this to x=1000 000 to obtain the corresponding value of y. I can't find out how to do it. I tried the interp function but it does not work. Help please?
From: Roger Stafford on
"Asghar " <asgharally(a)hotmail.com> wrote in message <hqa8uu$g95$1(a)fred.mathworks.com>...
> Hi guys,
>
> I've plotted a graph from some values ending at x =10 000.. Now i need to extrapolate this to x=1000 000 to obtain the corresponding value of y. I can't find out how to do it. I tried the interp function but it does not work. Help please?

There's a reason why 'interp1' won't allow you to do extrapolation as extended as you propose. The very purpose of interpolation and extrapolation is to make educated guesses as to the values of functions that you haven't directly computed or measured, but rather based on their nearby values and a tacit assumption of some kind of continuity in the functions and their derivatives. When you propose to go outside the known range of values by a factor of a hundred to one, one would usually conclude that the result would be essentially meaningless. Is there something special about your data that makes it otherwise?

Roger Stafford
From: Asghar on
"Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <hqai74$qb$1(a)fred.mathworks.com>...
> "Asghar " <asgharally(a)hotmail.com> wrote in message <hqa8uu$g95$1(a)fred.mathworks.com>...
> > Hi guys,
> >
> > I've plotted a graph from some values ending at x =10 000.. Now i need to extrapolate this to x=1000 000 to obtain the corresponding value of y. I can't find out how to do it. I tried the interp function but it does not work. Help please?
>
> There's a reason why 'interp1' won't allow you to do extrapolation as extended as you propose. The very purpose of interpolation and extrapolation is to make educated guesses as to the values of functions that you haven't directly computed or measured, but rather based on their nearby values and a tacit assumption of some kind of continuity in the functions and their derivatives. When you propose to go outside the known range of values by a factor of a hundred to one, one would usually conclude that the result would be essentially meaningless. Is there something special about your data that makes it otherwise?
>
> Roger Stafford

Well i had to time the elapsed time to sort out some randum numbers using bubblesort. I had to stop the random numbers to 10000 and plot time against numbers. And then i'm asked to find the time required to sort out by 1000000 and it says to find out by extrapolation. Is there any function for this? Would i get any meaningful answer?
From: Steven Lord on

"Asghar " <asgharally(a)hotmail.com> wrote in message
news:hqaipc$alq$1(a)fred.mathworks.com...
> "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in
> message <hqai74$qb$1(a)fred.mathworks.com>...
>> "Asghar " <asgharally(a)hotmail.com> wrote in message
>> <hqa8uu$g95$1(a)fred.mathworks.com>...
>> > Hi guys,
>> >
>> > I've plotted a graph from some values ending at x =10 000.. Now i need
>> > to extrapolate this to x=1000 000 to obtain the corresponding value of
>> > y. I can't find out how to do it. I tried the interp function but it
>> > does not work. Help please?
>>
>> There's a reason why 'interp1' won't allow you to do extrapolation as
>> extended as you propose. The very purpose of interpolation and
>> extrapolation is to make educated guesses as to the values of functions
>> that you haven't directly computed or measured, but rather based on their
>> nearby values and a tacit assumption of some kind of continuity in the
>> functions and their derivatives. When you propose to go outside the
>> known range of values by a factor of a hundred to one, one would usually
>> conclude that the result would be essentially meaningless. Is there
>> something special about your data that makes it otherwise?
>>
>> Roger Stafford
>
> Well i had to time the elapsed time to sort out some randum numbers using
> bubblesort. I had to stop the random numbers to 10000 and plot time
> against numbers. And then i'm asked to find the time required to sort out
> by 1000000 and it says to find out by extrapolation. Is there any function
> for this? Would i get any meaningful answer?

Well, you could simply fit a straight line to the data you have and evaluate
that fitted line ... but that won't help if the underlying relationship
between x and your time data is quadratic.

Okay, so you can fit a quadratic curve to the data you have and evaluate
that ... but again, that won't help if the underlying relationship is
sinusoidal.

So let's fit a sinusoidal curve to the data you have ...

Hopefully this shows why extrapolating so far from the data you have can be
dangerous at worst.

Now that being said, the shorter the distance you have to extrapolate, or
the better you know the relationship between your two variables, the better.
Using the timing data for generating between 1 and 10000 random numbers
should give you a fairly good estimate for how long it'll take to generate
10100 random numbers. But a million? Probably not quite as good.

If you really do need to perform this extrapolation, look at the
documentation for INTERP1 and notice the parameter after the "method" input.

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/interp1.html

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: Asghar on
the curve isn't actually a proper one.. then i've used the polyval function and then did a line of best fit. i thought i could extrapolate that line using matlab. is there a way of obtaining the function of that line? and then i could just work it out without matlab by doing calculations for linear extrapolation.

"Steven Lord" <slord(a)mathworks.com> wrote in message <hqajsh$st3$1(a)fred.mathworks.com>...
>
> "Asghar " <asgharally(a)hotmail.com> wrote in message
> news:hqaipc$alq$1(a)fred.mathworks.com...
> > "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in
> > message <hqai74$qb$1(a)fred.mathworks.com>...
> >> "Asghar " <asgharally(a)hotmail.com> wrote in message
> >> <hqa8uu$g95$1(a)fred.mathworks.com>...
> >> > Hi guys,
> >> >
> >> > I've plotted a graph from some values ending at x =10 000.. Now i need
> >> > to extrapolate this to x=1000 000 to obtain the corresponding value of
> >> > y. I can't find out how to do it. I tried the interp function but it
> >> > does not work. Help please?
> >>
> >> There's a reason why 'interp1' won't allow you to do extrapolation as
> >> extended as you propose. The very purpose of interpolation and
> >> extrapolation is to make educated guesses as to the values of functions
> >> that you haven't directly computed or measured, but rather based on their
> >> nearby values and a tacit assumption of some kind of continuity in the
> >> functions and their derivatives. When you propose to go outside the
> >> known range of values by a factor of a hundred to one, one would usually
> >> conclude that the result would be essentially meaningless. Is there
> >> something special about your data that makes it otherwise?
> >>
> >> Roger Stafford
> >
> > Well i had to time the elapsed time to sort out some randum numbers using
> > bubblesort. I had to stop the random numbers to 10000 and plot time
> > against numbers. And then i'm asked to find the time required to sort out
> > by 1000000 and it says to find out by extrapolation. Is there any function
> > for this? Would i get any meaningful answer?
>
> Well, you could simply fit a straight line to the data you have and evaluate
> that fitted line ... but that won't help if the underlying relationship
> between x and your time data is quadratic.
>
> Okay, so you can fit a quadratic curve to the data you have and evaluate
> that ... but again, that won't help if the underlying relationship is
> sinusoidal.
>
> So let's fit a sinusoidal curve to the data you have ...
>
> Hopefully this shows why extrapolating so far from the data you have can be
> dangerous at worst.
>
> Now that being said, the shorter the distance you have to extrapolate, or
> the better you know the relationship between your two variables, the better.
> Using the timing data for generating between 1 and 10000 random numbers
> should give you a fairly good estimate for how long it'll take to generate
> 10100 random numbers. But a million? Probably not quite as good.
>
> If you really do need to perform this extrapolation, look at the
> documentation for INTERP1 and notice the parameter after the "method" input.
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/interp1.html
>
> --
> Steve Lord
> slord(a)mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
>