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

1-Newbie

## Divide by zero error when trying to create a graph

We are getting into integrals etc and have managed to create some neat shapes. However, trying to create a Gabriels horn using parametric equations results in an error message of "divide by zero". Yet, extracting the y and z values on their own does give values not equal to zero, but trying to plot them even on their own gives the same error.

What are we doing wrong. Can anyone help.

6 REPLIES 6
4-Participant
(To:ptc-5053189)

3D plots are always a problem, CreateMesh is usually the easiest way to generate the data for the plot.

Both forms will give the same plot, just enable/disable to see any difference

See attached .

Regards

Andy

24-Ruby V
(To:ptc-5053189)

You can't plot z5 alone, you would have to use x5 and y5, too. You may do it as in the attached.

But here you would have to set the limits of the parameters in the 3D plot format menu, tab "Quickplot data" amd thats a bit cumbersome. So I think using Createmesh as Andy has shown is the better way and gives you more control.

1-Newbie
(To:Werner_E)

Thanks guys. I tried the CreateMesh and I like it. Does have certain benefits and also allows an alternative method to produce answers. Appreciated.

Barend

1-Newbie
(To:Werner_E)

If I change the function for y5 or z5 to r2 cos theta I can plot them individually. However, the moment I make it 1/r2 then if complains about division by zero although it still shows values, i.e. it still calcualtes both y5 and z5, but does not want to plot it.

4-Participant
(To:ptc-5053189)

That will be due to the quick-plot ranges that Mathcad applies for the graph.

If you look at the quickplot tab on the properties menu: Mathcad is plotting this over the range -5 to 5.

for r*cosTheta - no problem

but when you change to 1/r cos theta then there is a 1/0 issue at the mid point.

Changing the quick plot range will allow you to plot a graph but can be tricky to get a correct look.

Regards

Andy

Thanks

Announcements