Skip to main content
1-Visitor
May 29, 2014
Solved

Intersection of curves

  • May 29, 2014
  • 2 replies
  • 7552 views

Hello all, very new to mathcad, running express prime 3.0 on a trial.

I would like to find the intersection of some curves that are already on a plot. I don't have the functions of the curves or lines (lines would be straightforward to find). I've read previous posts that use the solver block method, however as I do not have the equations for the curves, I believe that this is not possible (could be wrong.)

How can I find the point of intersection for this given plot? (see image)

Best answer by Werner_E

Alexander Price wrote:

That's correct, two vectors for x and y for each curve.


Could you maybe do an example sheet for me?

You will sure find a lot of examples for interpolation here in the forum, even for Prime.

Given your screenshot I think linear interpolation would be a good choics and if xv and yv are the names of your vectors for x and y coordinates, you would simply define f(x):=linterp(xv,yv,x) and you have your function defined which you then can use for plotting but also for numerical operations like calculating the derivative or using it in a solve block.

The help for linterp() is pretty straightforward http://www.ptc.com/cs/help/mathcad_hc/prime3_hc/mprime/linear_interpolation.html#styler-id1.1.1.4.8.5.8.1

There is also an example here http://www.ptc.com/cs/help/mathcad_hc/prime3_hc/mprime/example_linear_interpolation.html#styler-id1.1.1.4.8.5.15.1

Not a good one, as the X values are assumed to be 0,1,... here.

If you want to use cubic spline interpolation you would define f(x):=interp(cspline(xv,yv),xv,yv,x)

For more help you would have to attach your worksheet.

2 replies

25-Diamond I
May 29, 2014

So you only have two curves given by a set of vectors of x and y coordinates each?

One way would be to write a routine which searches for points in both datasets which are close - chances are the point of intersection will not be in either dataset.

A second (and probably better) approach would be to use an interpolating function (spline, polynomial or linear) for each of the two datasets and find the point of intersection using a solve block.

The problem with both approaches is that they will not work in the express version because both the programming feature and the solve block are considered premium content by PTC and are not available in the free express edition after the 30day trial period.

1-Visitor
May 30, 2014

That's correct, two vectors for x and y for each curve.

I do not understand how to go about using the interpolation method, I have looked at the help section and still have trouble with the syntax, etc. I do have use of these features for 30 days, my company is in the process of getting full licenses.

Could you maybe do an example sheet for me? That would be greatly appreciated, it would have to be in the mcdx file type for me to open it though.

Thanks for the help so far.

Werner_E25-Diamond IAnswer
25-Diamond I
May 30, 2014

Alexander Price wrote:

That's correct, two vectors for x and y for each curve.


Could you maybe do an example sheet for me?

You will sure find a lot of examples for interpolation here in the forum, even for Prime.

Given your screenshot I think linear interpolation would be a good choics and if xv and yv are the names of your vectors for x and y coordinates, you would simply define f(x):=linterp(xv,yv,x) and you have your function defined which you then can use for plotting but also for numerical operations like calculating the derivative or using it in a solve block.

The help for linterp() is pretty straightforward http://www.ptc.com/cs/help/mathcad_hc/prime3_hc/mprime/linear_interpolation.html#styler-id1.1.1.4.8.5.8.1

There is also an example here http://www.ptc.com/cs/help/mathcad_hc/prime3_hc/mprime/example_linear_interpolation.html#styler-id1.1.1.4.8.5.15.1

Not a good one, as the X values are assumed to be 0,1,... here.

If you want to use cubic spline interpolation you would define f(x):=interp(cspline(xv,yv),xv,yv,x)

For more help you would have to attach your worksheet.

24-Ruby III
May 30, 2014

Can you attach worksheet?

1-Visitor
May 30, 2014

Thanks for the help, I think I got it working now.

25-Diamond I
May 30, 2014

Normally you shouldn't delete postings, just edit them.

Maybe you find the attached still useful