[Scilab-users] {EXT} Find the points of intersection of two curves

Rafael Guerra jrafaelbguerra at hotmail.com
Fri Jan 12 12:32:27 CET 2018


Hi,

This problem is equivalent to finding n-zeros over a given interval.
Matlab function fnzeros uses the following reference, which uses spline interpolation:

Mørken K. and Reimers, M. [2007] An unconditionally convergent method for computing zeros of splines and polynomials, Math. Comp., 76, 845--865

Regards,
Rafael

-----Original Message-----
From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Dang Ngoc Chan, Christophe
Sent: Friday, January 12, 2018 11:03 AM
To: Users mailing list for Scilab <users at lists.scilab.org>
Subject: Re: [Scilab-users] {EXT} Find the points of intersection of two curves

Hello Hermes,

If I understand well,, the core of your question :

> De : Hermes
> Envoyé : vendredi 12 janvier 2018 10:47
>
> How could I improve the accuracy of intersection points?

Lies here:

> s=LL(3,:)-LL(1,:);
> ym=s(1:$-1).*s(2:$);
> z=find(ym <= h);

So you have 2 curves which y-values are LL(1,:) and LL(3,:) and you search where the sign of the difference changes.
Correct?

So you suppose that both curves are continuous.

The refinement of the solution is more a mathematical topic than a Scilab one and I'm afraid I don't have the skill and time to analyze your functions.

There are some general methods you could use:
use a polynomial interpolation instead of a linear interpolation, i.e. choose an interval around the z values found above, perform a polynomial regression
- you have an example of such code here : https://fr.wikibooks.org/wiki/D%C3%A9couvrir_Scilab/Calcul_num%C3%A9rique#R%C3%A9gression_polynomiale - and search the local root of the polynomial.

You can also refine the step of calculation around the z values.

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
users mailing list
users at lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



More information about the users mailing list