linear extrapolation to abscissa

classic Classic list List threaded Threaded
5 messages Options
e-letter e-letter
Reply | Threaded
Open this post in threaded view
|

linear extrapolation to abscissa

Readers,

I want to plot a least squares fit linear regression for the following data set:

x=0,5,10,15,20; y=16,45,77,101,125

Then I want to perform an extrapolation to obtain a value for x when
y=0. How do I perform this please?

The documentation is very unfriendly to a statistics and scilab
novice! First I tried to read about the interp function but didn't
understand the spline references so moved to interpln instead. ;)

The help section should have stated that plot2d is prerequisite
knowledge. So I read about plot2d. What does the function yi perform?
What is the purpose of the apostrophe (') in the example shown in the help?

Yours,

[hidden email]

scilab 411
mandriva 2008

Stefan Du Rietz Stefan Du Rietz
Reply | Threaded
Open this post in threaded view
|

Re: linear extrapolation to abscissa

1. get [a, b] in y = ax + b

   coefs = regress(x, y);

2. calculate x for y = 0 from
   y = ax + b
   x = (y-b)/a

with y = 0:
   x = -b/a
that is
   x = -coefs(1)/coefs(2)

Stefan


On 2009-01-14 23:25, e-letter wrote:
--------------------

> Readers,
>
> I want to plot a least squares fit linear regression for the following data set:
>
> x=0,5,10,15,20; y=16,45,77,101,125
>
> Then I want to perform an extrapolation to obtain a value for x when
> y=0. How do I perform this please?
>
> The documentation is very unfriendly to a statistics and scilab
> novice! First I tried to read about the interp function but didn't
> understand the spline references so moved to interpln instead. ;)
>
> The help section should have stated that plot2d is prerequisite
> knowledge. So I read about plot2d. What does the function yi perform?
> What is the purpose of the apostrophe (') in the example shown in the help?
>
> Yours,
>
> [hidden email]
>
> scilab 411
> mandriva 2008
>

e-letter e-letter
Reply | Threaded
Open this post in threaded view
|

Re: linear extrapolation to abscissa

In reply to this post by e-letter
>1. get [a, b] in y = ax + b
Entering this into the scilab command resulted in error 276

>
>   coefs = regress(x, y);
>
>2. calculate x for y = 0 from
>   y = ax + b
>   x = (y-b)/a
>
>with y = 0:
>   x = -b/a
>that is
>   x = -coefs(1)/coefs(2)

Please explain in full detail; I do not understand any of what you wrote!

Stefan Du Rietz Stefan Du Rietz
Reply | Threaded
Open this post in threaded view
|

Re: linear extrapolation to abscissa

Sorry,
These (indented!) are the only commands you should enter
(the other lines were meant to be explanations):

1. The first command gives a vector coefs, which contains [a, b]
a = coefs(1)
b = coefs(2)

   coefs = regress(x, y);

2. The second command uses these: coefs(1) (which is a) and
coefs(2) (which is b) to compute x when y = 0 by rearranging
the first equation (y = ax + b):

   x = -coefs(1)/coefs(2)

I hope that you should be able to understand (or at least
use) what I wrote (trying to explain) earlier with this
addition.

Stefan

PS  You have to know some basic mathematics to use Scilab... ;-)


On 2009-01-15 00:15, e-letter wrote:
--------------------

>> 1. get [a, b] in y = ax + b
> Entering this into the scilab command resulted in error 276
>>   coefs = regress(x, y);
>>
>> 2. calculate x for y = 0 from
>>   y = ax + b
>>   x = (y-b)/a
>>
>> with y = 0:
>>   x = -b/a
>> that is
>>   x = -coefs(1)/coefs(2)
>
> Please explain in full detail; I do not understand any of what you wrote!
>

e-letter e-letter
Reply | Threaded
Open this post in threaded view
|

Re: linear extrapolation to abscissa

In reply to this post by e-letter
For the benefit of other novices, below are my commands in full:
x=[0 5 10 15 20];
y=[[16 45 77 101 125]
x=-coefs(1)/coefs(2)

scilab reports results:
x=-3.28...

How do I copy text in the scilab window into other programs?