Skip to main content
1-Visitor
September 16, 2010
Question

redefining a range of variables, replotting the graph

  • September 16, 2010
  • 17 replies
  • 8604 views

Hi there,

I define a variable in mathcad as "i" that has a range of values, say i=0,1, 2 upto 28. Next, I compute a function, say f(i). I can easily plot f(i) versus i.

However, I don't know how to plot g(j) versus j, where j(i)= 0.1*i . Also the label of the x-axis should be now "j" not "j(i)" and the label of the y-axis should be "g(j)". Also, that at a given value of i, g(j)=f(i).

See the file attached. Any help would be greatly appreciated.

Thanks,

Ashehad

17 replies

1-Visitor
September 16, 2010

Something like the attached?

Mike

AshehadAl1-VisitorAuthor
1-Visitor
September 16, 2010

Thanks Mike. It works well and I can modify it too.

Cheers,

Ashehad

1-Visitor
September 16, 2010

Thanks Mike.

No Problem.

All I changed was the Range Variable to a Vector Range. Just a matter of opinion, but I always try and keep away from Range Variables.

Mike

1-Visitor
September 17, 2010

i give u some example.

12-Amethyst
September 17, 2010

Andy,

you still have not defined a function, you have used a fuction to create an array, using the range variables.

If you type example(a,b)= you get a vector of numbers. In the plots, Mathcad is simply connecting points with

a straight line segment. You cannot use the root function, or any other functions meant to operate on a function,

on an array of points.

You could look at your example this way:

You generate a family of funcitons, one for each discrete value of a. b is then a variable, an you set the limits

(in the root function or on the graph) form 0 to 15. Now you can operate on each member of the family of curves.

You can operate on all familes of curves at the same time, for example,

root(a*cos(b),b,1,15)=

In your example, you will have 5 roots, so there might be a better function to find the roots.

Maybe the real problem you are working on would shed some light on what your are trying to accomplish,

maybe Jean knows, but I am still confused. If you have data, you need to fit a curve to the data to use the function

operators. The "linterp' function will produce the exact same curves as in your graphs, but you can operate on the

interp function like a continuous function in may ways, including numerical integration.

Wayne

1-Visitor
September 18, 2010

>Maybe the real problem you are working on would shed some light on what your are trying to accomplish,

maybe Jean knows, but I am still confused.< [Wayne]

___________________________________

Can't be more right, Wayne: very confusing. That's the last ting I could think of, i.e: solving for a family of function. A family of single valued function will have one inverse only. That kind of project for an unknown function should be passed in the forum for a quick answer. It does not exclude the user to study and make it work as far as he can. In this example, we have 3 pairs of solutions for a unique Y. There is no limit in the number of Y's to be solved for, just a matter of indexing and run and extract appropriately.

1-Visitor
September 17, 2010
>Further more, I modified "gg:=ff" to "gg(jj):=ff(ii)" so that I can find roots, if there is any. Using simple root function e.g root(gg(jj)-0.8,jj,0,2). I wish to locate the root. I know from simple mathematics that there is a root. But when I use "root(gg(jj)-0.8,jj,0,2)", certainly it can't locate. <
____________________
AFIU your root reference, solving for a function is the mathematical "InverseFunction". Some simple functions have an inverse , most don't have. Mathcad-Maple 11 and lower is very powerful in finding an "InverseFunction", in fact it can find about any. In some cases it leads to numerical instability, for which case we use the RootScanner instead. Here is the essential attached. What's red in this work sheet is normal red, i.e: not failure.
jmG

http://communities.ptc.com/message/152265#152265