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

Variable is undefined

JB_10220769
7-Bedrock

Variable is undefined

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

 

Jon

1 ACCEPTED SOLUTION

Accepted Solutions

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.

Werner_E_0-1645718632092.png

 

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

Werner_E_1-1645719020760.png

 

 

View solution in original post

3 REPLIES 3

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.

Werner_E_0-1645712269284.png

 

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

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.

Werner_E_0-1645718632092.png

 

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

Werner_E_1-1645719020760.png

 

 

Top Tags