cancel
Showing results for
Did you mean:
cancel
Showing results 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

21-Topaz II

## How do I draw a given distribution on a moving plane orthogonal to the axis of a tube?

Hi!,
Basically I have to draw the surface distribution given by the function f (y, z) on the plane of the tube section whose position on the axis is changed by moving the cursor of the slider. The fact is that unexplained phenomena occur when the cursor is moved, such as enlargement or shrinkage of the tube. Is anyone able to put order into that program?

I solved a similar problem for a community member about ten years ago or more, without the use of createmesh but only with programming. I can not find it anymore.

16 REPLIES 16
23-Emerald II
(To:-MFra-)

@-MFra- wrote:

Hi!,
Basically I have to draw the surface distribution given by the function f (y, z) on the plane of the tube section whose position on the axis is changed by moving the cursor of the slider. The fact is that unexplained phenomena occur when the cursor is moved, such as enlargement or shrinkage of the tube. Is anyone able to put order into that program?

I solved a similar problem for a community member about ten years ago or more, without the use of createmesh but only with programming. I can not find it anymore.

I think the problem is caused by the variation in the z-axis values of F when using create mesh. It can range from 0 to ±A and this affects the scaling of the z-axis.  One solution is to scale the z-axis to match the width(height?) of the box.   I've added a few functions to the collapsed region to facilitate this.

You might need to play around with the values to ensure that they don't mess up the other axes ...

Stuart

25-Diamond I
(To:-MFra-)

Not sure what effect you actually would like to achieve, but if its just the tube's length which is of interest, you could simply disable auto scaling the z-axis

Unfortunately you have to type in the value manually and can't use the variable "length" here. At least not with the 3Dplot component provided by Mathcad out of the box.

23-Emerald II
(To:Werner_E)

@Werner_E wrote:

Not sure what effect you actually would like to achieve, but if its just the tube's length which is of interest, you could simply disable auto scaling the z-axis

Unfortunately you have to type in the value manually and can't use the variable "length" here. At least not with the 3Dplot component provided by Mathcad out of the box.

That's a possibility.  I'd forgotten about z-axis limits ...

These values seem OK:

Another option occurred to me.  AFAIA (and I stand ready to be corrected), a contour plot is projected onto the backplane.  What would be nice is if the "contour" could be displayed at the kth position (x).  By suitable scaling and translation of F, and setting it to a colormap-filled surface plot, this seems to be possible:

Stuart

23-Emerald II
(To:StuartBruff)
21-Topaz II
(To:-MFra-)

Thanks to all for the answers.

To be clearer, I would like the right 3D graphic of the StuartBruff animation to work like the one on the left as well. The difference from the left one is that there has been a rotation of 90 degrees in the positive direction around the y axis so that the tube has an edge coinciding with the x-axis. In the photo on the right, I don't know why it's shifted to the left.

The study of the system was first done by considering the axis of the tube parallel to the x-axis and therefore the distribution is f (y, z), then considering the axis of the tube the z-axis and therefore the distribution is f (x, y) in practice obtained with the rotation of the previous image.

(I usually color the axes as follows: x in black, y in blue, z in red.)

23-Emerald II
(To:-MFra-)
23-Emerald II
(To:-MFra-)

@-MFra- wrote:

Thanks to all for the answers.

To be clearer, I would like the right 3D graphic of the StuartBruff animation to work like the one on the left as well. The difference from the left one is that there has been a rotation of 90 degrees in the positive direction around the y axis so that the tube has an edge coinciding with the x-axis. In the photo on the right, I don't know why it's shifted to the left.

See attached (also video in accompanying message) - is this what you're after?

Stuart

21-Topaz II
(To:StuartBruff)

Thank you!

in fact, it satisfies me in part. What I would like is shown in the photo. Why if I change something in the 3DFormat does the animation stops working?

Also, I would like to replace mkbox with cube or cuboid from plottool, could you suggest to me how to do it?

25-Diamond I
(To:-MFra-)

According the unclear contour plot in the left pic, you should change the plot type of Plot 2 from "Surface Plot" to "Contour Plot".

21-Topaz II
(To:Werner_E)

Thanks a lot!

Yes, but the animation doesn't work anymore!

23-Emerald II
(To:Werner_E)

@Werner_E wrote:

According the unclear contour plot in the left pic, you should change the plot type of Plot 2 from "Surface Plot" to "Contour Plot".

@-MFra- notes, the "contour" map doesn't move anymore.   This is because a true Contour Map projects onto the corresponding backplane, regardless of where you want it along its chosen axis (z-axis in this case).

What the "working" version shows is a nearly-flattened surface plot with colormapped Fill Contour and Contour Lines enabled.  The colormap range is that of the z-axis range used by all meshes.  AFAICT, this explains its poor quality.  As the flattened surface only occupies a small amount of this range, there is a limited range of colour depth available.  I can't find a way to improve it using just the available dialog.   I'm not sure if there's a way to do so by scripting - it will, of course, then no longer be compatible with Mathcad Prime 7 (putting aside Prime's lack of animation).

The right-hand 3DPlot looks better because it is a genuine Contour Plot.  Although it's still restricted to the backplane, it can be moved anywhere on that backplane.  All I've done is offset it so that the middle of the contour plot is at the corresponding x-value.

Stuart

25-Diamond I
(To:StuartBruff)

An option could be to move the tube in opposite direction instead of the contour plot. But then the scale on the red z-axis would show changing, wrong values.

23-Emerald II
(To:Werner_E)

@Werner_E wrote:

An option could be to move the tube in opposite direction instead of the contour plot. But then the scale on the red z-axis would show changing, wrong values.

And adding to the misery, the backplane moves too. ☹️

25-Diamond I
(To:StuartBruff)

@StuartBruff wrote:

@Werner_E wrote:

An option could be to move the tube in opposite direction instead of the contour plot. But then the scale on the red z-axis would show changing, wrong values.

And adding to the misery, the backplane moves too. ☹️

Ah yes, my bad. For a moment I thought that the contour would remain in the xy-plane but of course thats not the case.

21-Topaz II
(To:-MFra-)

I take this opportunity to wish everyone, despite the known difficulties due to the pandemic, a happy new year.

21-Topaz II
(To:-MFra-)

So far, no solution has been found to the problem.

Announcements

Top Tags