Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
How to get the intersection points when the number of when the number of interpolation function is large?
I have many data. so I should use "for loop".
However, Results of my mathcad code was wrong.
I need help!!
I explain my problem and attach file including data file.
1. My data "M" is 50X28 array
2. I want to get intersection points of these array.
My data consists of descrete points. Thus, I use interpolation function.
The even-numbered column of array "M" is the x-axis and the odd-numbered column of array "M" is the y-axis.
ex. M<0> (column 0 of M) and M<1> (column 1 of M) -> interpolation function (line 1)
M<2> and M<3> -> interpolation function (line 2)
M<4> and M<5> -> interpolation function (line 3)
M<6> and M<7> -> interpolation function (line 4)
3. intersection point of two line getted by interpolation funtion
line1 and line2 -> Intersection point (x1,y1)
line2 and line3 -> Intersection point (x2,y2)
line3 and line4 -> Intersection point (x3,y3)
In this case, lines are only 4. If the number of line is large, I don't know how to do...
please help me
Solved! Go to Solution.
You may turn your solve block into a function with three arguments: guess value and the two functions you are searching the intersection of.
"fit" creates the interpolation function and will accept numbers from 0 to 13 as argument. No error checking. Maybe it would be nicer to make M a second argument of that function and make it ORIGIN independent.
Now you may create a table of all 91 points of intersections
or use the function to calculate single points of intersection
Hi,
Your lines meet at small angles. Answer would vary greatly if you decide
a) to use linear line between successive points or
b) say a spline or other equation through the data.
You need to make this decision first.
@terryhendicott wrote:
Hi,
Your lines meet at small angles. Answer would vary greatly if you decide
a) to use linear line between successive points or
b) say a spline or other equation through the data.
You need to make this decision first.
No, he doesn't need to make that decision beforehand. Method can be the same, no matter which kind of interpolation is chosen.
And RussianBlue already decided for spline interpolation using lspline, as can be seen in his sheet and pdf.
You may turn your solve block into a function with three arguments: guess value and the two functions you are searching the intersection of.
"fit" creates the interpolation function and will accept numbers from 0 to 13 as argument. No error checking. Maybe it would be nicer to make M a second argument of that function and make it ORIGIN independent.
Now you may create a table of all 91 points of intersections
or use the function to calculate single points of intersection
I appreciate your answer and I am sorry for delay.
You made my complicated problem easy. You are so great!
However, I don't understand one point.
How did you define x in the second line?
The x was never defined in your code.
Although x was not defined, x was written in the graph and the graph was drawn without error.
What I asked was that the x range of the fitted graph would be equal to the range of the actual data points.
Is this implemented in your code?
The feature you are asking for is called Quickplot. If you provide an undefined variable at the abscissa, Mathcad/Prime will happily plot any function with that varaible as argument. Give it a try - create a new plot, use x at the abscissa (I'm assuming that you did not define anywhere above in the sheet, use sin(x) at the ordinate and you should see a plot of the sine.
The abscissa range defaults to -10..10, but you can change the range if you edit the numbers at the abscssa. in prime you can edit the first, second and last number on a scale. Its hard to do as of the small font size used and the overall mediocre handling of Prime.
Thats what i did in the file I provided. The x-range that way is hard coded in the plot.
For clearness and versatiliy it would have been better to define a range for x rather than editing the limits in the plot istself.
Thank you very much!!!