Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Optimisation problem: Find the best N pts (x,y) to...

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-12-2020
09:14 AM

06-12-2020
09:14 AM

to all,

A bit of an open question as I do not know how to go about solving the following – if it can be done at all

I have a curve C1, define between [x1,xn] and I would like to create a curve C2 using N pts so that some criteria are met. Essentially is a “double optimisation” problem. Consider the following; I want C2 to be made of p points p(xi,yi) – Generally a few points (say no more than 10)

Criteria 1:- xn > xn-1 > x1 . xn and x1 are given

Criteria 2: In a given x range [xn,x+1] rms C1 ~ rms C2 . Within a given a tolerance (say +/-1%).

Is there of way of using Mathcad to find the best pair of points to meet criteria #2

Does it require some sort of loop, or is there some built-in optimisation tool one can use

Attached a mcad 15 file swith some preliminary stuff - Not much

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-13-2020
06:41 AM

06-13-2020
06:41 AM

8 REPLIES 8

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-12-2020
11:56 AM

06-12-2020
11:56 AM

Re: Optimisation problem: Find the best N pts (x,y) to meet criteria?

I think your explanation could be expanded as it's not fully clear to me what you are after. From what I 'think' you're asking, aren't you just trying to get points off of C1? If your criteria is rms(c1)=rms(c2) then c2=c1 is your obvious answer, you just want a smaller set of points along a given interval. You could fit a b-spline and grab spaced points along c1. Or other interpolation type. Not exactly what you asked for but I think gets your end goal. Otherwise there are an infinite number of solutions where rms(c2) = rms(c1).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-12-2020
02:19 PM

06-12-2020
02:19 PM

Re: Optimisation problem: Find the best N pts (x,y) to meet criteria?

Thanks for the reply. I appreciate I wasn’t clear about what I am trying to do. Still trying to put it in words

imagine the following. Using the Simpson method for integration by splitting a range [a,b] into n equivalent length. Let’s say I split this range into 2 rectangles. It’s fairly easy to find the “middle” point so that the area A of each rectangle is close to the exact integral

what I am thinking at the moment is if there is a way of “automatically” finding the best positions of say N points so that the area in each “bin” is a close match. If the raw data as a x increment =1 over say [10-2000] range then choosing 1990 points would be an exact match

With the attached diagram

I split the range into 3 areas . I therefore "decided" I want to use a vector {f1,f2,f3,f4} in all cases f1 and f4 are "fixed" i.e. decided by the user. I therefore will have a vector y={y1,y2,y3,y4}

Is there a way of finding the best values for (f2,y2) & (f3,y3) so that

area sqrt(A1) ~ sqrt(A'1); sqrt(A2) ~ sqrt(A'2) and sqrt(A3)~ sqrt(A'3) where the A areas from Curve C1 and A' the areas from the points I am trying to establish

also added a mcad 15 example but needed 5 pts to "look" good. Not checked the areas,etc

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-12-2020
07:11 PM

06-12-2020
07:11 PM

Re: Optimisation problem: Find the best N pts (x,y) to meet criteria?

Hi,

*"what I am thinking at the moment is if there is a way of “automatically” finding the best positions of say N points so that the area in each “bin” is a close match"*

Cheers

Terry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-13-2020
02:21 AM

06-13-2020
02:21 AM

Re: Optimisation problem: Find the best N pts (x,y) to meet criteria?

Thanks Terry. I realised very late last night that it’s more or less what I want to - was thinking about integration in finite element method in range -1 to 1.

What I am not sure is the weighting factors. Would wC1(x) be the value I am after if I chose x?

I have in mind selecting a number of n points (x) by judgment eye-balling the curve and then have mathcad find all the appropriate y values for the selected set.

would there be a way in math and to solve this?

Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-12-2020
11:18 PM

06-12-2020
11:18 PM

Re: Optimisation problem: Find the best N pts (x,y) to meet criteria?

Hi,

Are you ultimately after the integral of whole set of data. A similar technique can be used to determine integral (area) between any two data points.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-13-2020
02:24 AM

06-13-2020
02:24 AM

Re: Optimisation problem: Find the best N pts (x,y) to meet criteria?

Thanks. Not really as the (sqrt of the) integral is a given i.e easy to set-up I am using the same method as you kindly offered but use a log-log integration. I also have a method somewhere which fits a cspline to the data first and then do integration.

Did some searches on the Gauss integration-attached pdf. It is what I am trying to do but I do not know if the "solving" can be done in mcad. I suspect it can. Might be a minimisation problem! I think I started laying out the problem a bit better and the "key" step is how to use and set up the 'Given' block

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-13-2020
06:41 AM

06-13-2020
06:41 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-13-2020
07:58 AM

06-13-2020
07:58 AM

Re: Optimisation problem: Find the best N pts (x,y) to meet criteria?

I think so.

I'll have a look as I need to correct a few thing in the posted sheet - I need to modify it so that I deal with "sloping" rectangle (trapezoid) rather than rectangle as this approach is too limiting and woudl only work is very few special cases (when I get to the real "thing")

May need a loop

start with (x1,y1) (x2) find best value of y2 to match the area A1

use (x2,y2) and x3 find best value of y3 to match the area A2

and so on

the selectin of the x values will always be a user's choice