Plotting 2D graph from function with 2 unknowns
Plotting 2D graph from function with 2 unknowns
(OP)
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
.
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.
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
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
TTFN

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
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
i := 0;10
x[i := i
Y[i := g(x[i)
http://files.engineering.com/getfile.aspx?folder=c...
TTFN

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
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
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
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
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.