Skip to main content
8-Gravel
February 24, 2022
Solved

Variable is undefined

  • February 24, 2022
  • 1 reply
  • 1759 views

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

 

Jon

Best answer by Werner_E

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

 

 

1 reply

25-Diamond I
February 24, 2022

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

 

8-Gravel
February 24, 2022

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

Werner_E25-Diamond IAnswer
25-Diamond I
February 24, 2022

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