Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mathcad Graphing 3

Status
Not open for further replies.

Ortiz

Structural
Jan 17, 2002
2
Can somebody tell me, I want to know if it is possible to use Mathcad to make a graph with two differents Y-axis values, namely, I want to show the variation of X values with two different set of Y-axis variables which have no relationship between, so I want to put one set of Y values at the left-side of the graph and the other set at the right-side.

This kind of graph is used in Soil Mechanics.


 
Replies continue below

Recommended for you

Mathcad graphs are pretty limited, that's one fo the reasons that it used to come with Axum.

My usual modus operandi is to calculate in Mathcad and plot in Excel.

TTFN
 
Hi Ortiz,

Sure, Mathcad graphs can do what you ask, you just have to be a little circumspect in how you set up your data structures.

You'll need to use arrays, so start out something like this:
(Note that I use := for : in Mathcad, .. for ;, [ for functional subscript and . for literal subscript)

N:=100 The number of values in your arrays
n:=0,1..N Set up a range on n

Now, fill your two Y ranges in a linear manner like this:

y1.min:=-10
y1.max:=10

y1[n := ((y1.max-y1.min)/N)*n+y1.min

y2.min:=-1
y2.max:=1

y2[n := ((y2.max-y2.min)/N)*n+y2.min

Now, fill your x array however you wish. Let's say you already have some function f that does the job.

x[n := f(y1[n),y2[n)

Then, plot a Mathcad graph, by typing
y1[n@x[n

You're halfway there, now click inside the graph directly after where the y1[n apprears, and type a comma. This will create a blank placeholder directly under y1[n for a second plot. You may have to use the spacebar to get the cursor positioned exactly on the far right side of y1[n otherwise when you type the comma, it will try to add a second index dimension after the n for the y1 array. Type y2[n in the second plot placeholder and you are good to go! You can have as many as 16 different plots on one Mathcad graph. Notice that the graph is basically pairing up values from the y1 array with the x array and the y2 array with the x array. So, you need to make sure that all of these arrays are the same size or it won't work.

Hope this helps!
mattman206




 
Hi again,

I just realized that it's easier to get a two-plot Mathcad graph by typing

y1[n,y2[n@x[n

instead of that last command right before the paragraph "You're halfway there".

HTH,
mattman206

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor