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
- :
- Find() with indexing for "iteration"?

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-14-2020
04:00 AM

06-14-2020
04:00 AM

to all

I think I had an example of what I am attempting but lost hard drive a while ago means I have lost it.

I would like to use indexing in a Given block. Please see attached. Can this be done if so what is the correct mathcad 15 syntax?

Aim is to return a vector of solution for each index i

Thanks

Regards

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-14-2020
08:09 PM

06-14-2020
08:09 PM

Are you looking for something like this:

From your example it looked like you alwys want to use 1 as guess value for m and not the last m of the iteration. Therefore I also implemented it that way.

The values are not what you expected but I think the routine is doing what you demanded in your description.

6 REPLIES 6

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

06-14-2020
08:46 AM

06-14-2020
08:46 AM

Re: Find() with indexing for "iteration"?

You can make the result of the Solve block a function, in your case that would be

msol(i), and then you replace in the first solve block 1=>i, and 2=>i+1

Success!

Luc

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

06-14-2020
10:23 AM

06-14-2020
10:23 AM

Re: Find() with indexing for "iteration"?

Thanks LucMeekes - Half-expected a reply from you 🙂

Not quite success I am afraid - I am sure I did something similar a looong time go but my memory is nearly totally gone

I am getting a "Unitless" issue

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

06-14-2020
10:47 AM

06-14-2020
10:47 AM

Re: Find() with indexing for "iteration"?

Your yv has only one element, you can't have j index that, same as xv.

Success!

Luc

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

06-14-2020
11:58 AM

06-14-2020
11:58 AM

Re: Find() with indexing for "iteration"?

Thanks. But I had in mind the following once I have mj I can calculate vyj which is the starting for the next iteration

j = 1 range xv1-xv2, find m1, calculate yv2

j = 2 range xv2-xv3, find m2 , calculate yv3

j = 3 range xv3-xv4, find m3 calculate yv4

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

06-14-2020
08:09 PM

06-14-2020
08:09 PM

Are you looking for something like this:

From your example it looked like you alwys want to use 1 as guess value for m and not the last m of the iteration. Therefore I also implemented it that way.

The values are not what you expected but I think the routine is doing what you demanded in your description.

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

06-15-2020
02:57 AM

06-15-2020
02:57 AM

Re: Find() with indexing for "iteration"?

Thanks a lot for the input and programm. Not sure I would have figured out the coding. But looking at it makes sense and it's almost obvious.

Don't think the value for mguess make much of difference.

it's interesting that the m3 and m4 (to get yv3 and yv4) are not what I expect. Still a step in the right direction

Thanks a lot

[EDIT]. I can't type numbers! the values in variable ATarget are the cumlutative ara and not the area for each band as I wanted to enter. if one uses Atarget={146.06, 360.62,250}T then the programm returns yv={1,2,0.5,0.5}