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

7-Bedrock

## Variable is undefined

I am not getting answer what exactly I am doing wrong. Help please!

Jon

1 ACCEPTED SOLUTION

Accepted Solutions
24-Ruby V
(To:JB_10220769)

Whats the reason for the range? What would you like to achieve?

If the reason is to create a table of values (just for viewing, you can't use that table for anything else unless you use a vector instead of a range), you can't include z=0 because in your formula you divide by z and so you run into a division by zero. You may start the range at 0.1 ft with 0.2 ft as second value in that case.

If you intend to use the range just for plotting Z(z), starting it with zero should be no problem as the error we get for z=0 is simply ignored by the plot.

Of course you could also redefine function Z using try/on error and assign any value, an error message or NaN (Not-a-Number) in case of the original function failing. It all depends on your needs

3 REPLIES 3
24-Ruby V
(To:JB_10220769)

Don't follow a function definition by an evaluation (=) !

Evaluate the function in a separate region.

But there are more mistakes in your sheet.

Your range for z starts at 0 and so you run into a division by zero.

Furthermore there is a unit mismatch when you add X and Y.

I changed the range to start at 0.01 ft and added a square in the formula for Y(z). Not sure if thats appropriate but it makes you sheet work OK and you get the idea.

7-Bedrock
(To:Werner_E)

Now I got it. Thank you. So can I not use the range starting from 0? Is there any alternate method to have the range starting from 0

24-Ruby V
(To:JB_10220769)

Whats the reason for the range? What would you like to achieve?

If the reason is to create a table of values (just for viewing, you can't use that table for anything else unless you use a vector instead of a range), you can't include z=0 because in your formula you divide by z and so you run into a division by zero. You may start the range at 0.1 ft with 0.2 ft as second value in that case.

If you intend to use the range just for plotting Z(z), starting it with zero should be no problem as the error we get for z=0 is simply ignored by the plot.

Of course you could also redefine function Z using try/on error and assign any value, an error message or NaN (Not-a-Number) in case of the original function failing. It all depends on your needs

Announcements
Top Tags