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

Translate the entire conversation x

Undefined variable help

BG_7818704
4-Participant

Undefined variable help

I'm working with one of my professors on Mathcad to use curve fits in checking values gathered from another program. Defining unitless (but not really) temperature and pressure, I'm running into an issue where a variable in a loop I'm using is undefined. I'm feeding a pressure variable into a base 10 log function, but with no success as it complains it is undefined. Any help would be appreciated. Screenshot (252).png

1 REPLY 1
LucMeekes
23-Emerald III
(To:BG_7818704)

You didn't define Lp. The bold equals = you use in Lp=log(p/atm), is an equality operator, not an assignment. You should use :=, which you get by typing just a colon    :

 

See the Lp:=  to the right.

 

Next thing is the atm, I assume that's the unit atmosphere. You defined p without a unit. Dividing it by a unit in the argument to the log function will cause another error, since that argument should be unitless. Define p with the unit atm, or remove the division in the log() function.

 

Success!
Luc

Announcements

Top Tags