Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
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)
Solved! Go to Solution.
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.
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.
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.
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.
Can you attach worksheet?
Thanks for the help, I think I got it working now.
Normally you shouldn't delete postings, just edit them.
Maybe you find the attached still useful
Thanks Werner, that was extremely helpful.