Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Plotting 2D graph from function with 2 unknowns

Plotting 2D graph from function with 2 unknowns

Plotting 2D graph from function with 2 unknowns

Hi all,

first post for me.

I have an issue where i need MathCad to plot a line in a 2D plot.
The function i want to plot is a function of 2 unknowns, lets say x and y, so the function could be f(x,y)=x^2+y^3. This function results in a surface plot(3D)
I have decided the following:
1. The function value shall always be a fixed value, lets say zero(0). I guess this would mean that i cut a slice at a specified level.
2. That x shall operate within a specific range, lets says from [-2,2]

It is relatively simple to extract the data manually:
Inserting -2 as x:
0=(-2)^2+y^3 => y = -1.59 >>>>> (x;y) = (-2;-1.59)
Inserting -1.8 as x:
0=(-1.8)^2+y^3 => y = -1.48 >>>>> (x;y) = (-1.8;-1.48)
and so on until x = 2.

I then get x and y coordinates which can be plottet in 2D.

Finally my question smile.
Does anyone know how to make a program so MathCad will insert the x values from the specified range and then calculate the corresponding y values. Then i want to log the data points (x;y)and plot the line for these points in 2D.
In short is it possible to automatize the manual inserting of x values?

All ideas are welcome.

Thanks all.

RE: Plotting 2D graph from function with 2 unknowns

Hi IRstuff,
No it is not school.
It will be used for an equation which uses the critical force and length as input (unknowns) for a pinned-pinned linear actuator. By setting the equation value to 0 an equilibrium is reached, which defines the actuators safety factor against buckling.
Typically I have used Eulers theory for buckling of columns, but this only accounts for a single value of cross-sectional moment of inertia. But the cylinder tube and rod have different values for this, so the formula is quite conservative for a hydraulic actuator.

RE: Plotting 2D graph from function with 2 unknowns

OK, so assuming that f(x,y)=0 is the constraint, then putting that constraint into a Solve block and assigning, say, g(x) := find(y), you then simply take an indexed array of x as input into g, like
i := 0;10
x[i := i
Y[i := g(x[i)


FAQ731-376: Eng-Tips.com Forum Policies

Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers

RE: Plotting 2D graph from function with 2 unknowns

Hi IRstuff,

thanks a lot for the help. Your example shows how this can be done.
Next step for me is to make the calculations with units, but i will try to manage this on my own.
Again thanks for the input.

RE: Plotting 2D graph from function with 2 unknowns

What you are trying to do is slicing your 3D-surface with planes parallel to the x-plane. What you get are contour lines, so maybe even a (3D) contour plot does what you want.
ITStuff showed how to do it with f(x,y)=0 but of course it would work with f(x,y)=a=const. the same way.
The problem is that what you ask for is the plot of an implicit function. This is a long standing wish of Mathcad users but its still not implemented.
The way using the solve block IRstuff suggested works, but it will find one solution only and this solution will depend on the guess value or on the additional constraints you add in the solve block (i.g. you could demand that y>0).
As an example- if f(x,y):=sqrt(4-x^2-y^2), thats the upper half of a sphere, you won't get the full circles plotted but at best only half circles, in worst case the solve block will find sometimes solution from one half and then again from the other half.
It depends on your application if you can use this or if there may be another way doing it.
I suggest you post a sheet if you need further help.

RE: Plotting 2D graph from function with 2 unknowns

Hi rmix22,

thanks for your input.

IRstuff let me on the way to the solution which works for me. One of the problems was that i had difficulties using units, because the subscript does not like this. So i tried my way around and came to a more simple setup.
And you are correct, the initial guess value is of importance to the actual found solutions. What i did was to plot the function with 2 unknowns (actual 1 unknown, because i know the range of one of the variables) and inserted the min and max value. This then gave a min and max solution value, which also lets me know what my initial guess should be between. See figure 1. Figure 2 compares the various critical buckling forces (Blue Line is P_CR(LR)) and figure 3 shows the calculated safety factor against buckling. So all in all IRstuff let me in the right direction and i just fine tuned a bit.
The manual way took me about 30min to get an acceptable graph where the new method takes about 30sec.

RE: Plotting 2D graph from function with 2 unknowns

There is not much that can be seen from a pdf but if your sheet does what you want all is well, I guess.
As you wrote about problems with units and subscripts - there are two different subscripts in Mathcad, the literal subscript (which sure doesn't throw any error with units) and the vector/matrix subscript. I guessed you used the latter and so you were creating a vector. There is a limitation with vectors/matrices and units in Mathcad 15 and below - all elements of a vector must have the same unit. I guess this is the problem you ran into. So unless you really need vectors (don't see any in your pdf, I guess) you should be using literal subscripts.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close