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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Unexpected 'undefined variable' error?

JohnWoodgate
6-Contributor

Unexpected 'undefined variable' error?

I expect this is something stupid I've done, but I can't see what.The attached file accepts the variable 'z until the last line. Why?

ACCEPTED SOLUTION

Accepted Solutions
wayne
12-Amethyst
(To:JohnWoodgate)

Prior to your problem with z; x and y are predefine vectors, but z was always input as a scalar in the functions.

Up to the point of your problem, the variable z was never assigned a value, out side of an argument list.

In the last equation cf does not have an argument list (x,y,z), which I think you want. At least you need cf(z)=

Since the vectors x and y were defined prior to the function definition, they do not actually have to be in the argument list, unless you want to use the functions again with different x and y vectors.

View solution in original post

2 REPLIES 2
wayne
12-Amethyst
(To:JohnWoodgate)

Prior to your problem with z; x and y are predefine vectors, but z was always input as a scalar in the functions.

Up to the point of your problem, the variable z was never assigned a value, out side of an argument list.

In the last equation cf does not have an argument list (x,y,z), which I think you want. At least you need cf(z)=

Since the vectors x and y were defined prior to the function definition, they do not actually have to be in the argument list, unless you want to use the functions again with different x and y vectors.

JohnWoodgate
6-Contributor
(To:wayne)

Thanks: something stupid, as I thought. cf should be cf(x,y,z).

Announcements

Top Tags