cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

...again plot units...

Desiv5-disabled
1-Newbie

...again plot units...

Hello,

I am not able to obtain an xy plot with the right units: I have a "Fk" force, defined as a function of the length "x"; I have already applied the "trick" with dividing the plotted parameters through the units I want to have, but my graph remains empty... Could somebody give me an advice?

Thanks in advance.
9 REPLIES 9

You can only divide the variable on the x-axis by the units if that variable had units to begin with. Since you are using a quick plot, that's not the case (Mathcad can't read your mind, and therefore has no way to know what the units are supposed to be). Explicitly define x over the desired plot range, with units. For example

x:200*mm,205*mm;400*mm

Richard

On 5/26/2009 9:53:06 AM, rijackson wrote:
>You can only divide the
>variable on the x-axis by the
>units if that variable had
>units to begin with. Since you
>are using a quick plot, that's
>not the case (Mathcad can't
>read your mind, and therefore
>has no way to know what the
>units are supposed to be).
>Explicitly define x over the
>desired plot range, with
>units. For example
>
>x:200*mm,205*mm;400*mm
>
>Richard
_____________________________

Another approach is to discretize the range variable and apply the conversion on the vector of values. Often it is desirable not to show the plotting arguments and label the X, Y axis for a clean plot to the client. Discretizing a project takes a bit more memory but you get an export [data table].

jmG

Thank you for your replies, it worked. Now I'm having other 2 problems:
-1. As you can see in the attached file, the plot will display only the left side of the graph, although there is also a right side, symetrical placed to "0"... I can even read the values also on the right graph side with the Trace function, but why it's not displayed?
-2. I'm trying to display in my graph the plot of several varants of the force-function: Fk(L,10mm), Fk(L,12mm), Fk(L,15mm)... but Mathcad doesn't appear to be able to calculate them, because the calculation starts and never ends (light-bulb is blinking forever) and I have to kill the Mathcad task in taskmanager to stop it... Am I doing something wrong again? As you see, the function is not complex at all, so it should not be a problem for Mathcad to calculate it...

Thank you in advance for your further support!

On 5/27/2009 2:05:36 AM, Desiv5 wrote:
== -1. As you can see in the attached file, the plot will display only the left side of the graph, although there is also a right side, symetrical placed to "0"... I can even read the values also on the right graph side with the Trace function, but why it's not displayed?
== -2. I'm trying to display in my graph the plot of several varants of the force-function: Fk(L,10mm), Fk(L,12mm), Fk(L,15mm)... but Mathcad doesn't appear to be able to calculate them, because the calculation starts and never ends (light-bulb is blinking forever) and I have to kill the Mathcad task in taskmanager to stop it... Am I doing something wrong again? As you see, the function is not complex at all, so it should not be a problem for Mathcad to calculate it...

Same root cause - there is a singularity at L = 0 mm. Interestingly, if you select symbols on the trace, the rhs symbols show even though the line doesn't.

Alter the range variable, or put a condition in Fk, to skip 0.

Your original worksheet is fine in Mathcad 11.

Stuart

Oh... of course, you're wright! Thanks a lot, everything is ok now!
Wish you all a nice day!

Graphs with units turn very soon hard to manipulate. Often, for a clean plot you will have to hide the arguments.

jmG

Thanks jmG!
Your answer is generating another question from my side: with the definition of the range for "L" in your file, Mathcad will "jump over" the zero value, but I don't really understand why... The step is 2, so, starting from -1000, L should become also "0", but it doesn't... Can you please explain me that shortly?
Thank you in advance.

L does become zero. But the 2D plot ignores invalid points. That includes non-numeric values (like NaN), complex values, and points where the expression fails to evaluate. This does not work with 3D plots, so be careful with those.
__________________
� � � � Tom Gutman

Generally, the QuickPlot will ignore the singularity like x/0, it does in your application. Some more complex plot may not ignore x/0, but will report it as red and the error message "... may be dividing by 0". If you would want some nice discretized values for L (like here) and wheres it wouldn't calculate @ L=0, you would then have to include a condition exclusive of L=0. Doing so will then enable the nice ranging but excluding the singularity, which singularity you don't need anyway.

jmG
Top Tags