[Scilab-users] {EXT} Find the points of intersection of two curves
Dang Ngoc Chan, Christophe
Christophe.Dang at sidel.com
Fri Jan 12 11:03:19 CET 2018
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.
More information about the users
mailing list