Skip to main content
1-Visitor
October 20, 2011
Question

variable is undefined

  • October 20, 2011
  • 3 replies
  • 8340 views

Hi everyone,

I have a problem with the variable being undefined. In the Mathcad 14 file I attached, at the end of the codes, they say my 'base' and 'lambda' is undefined but I clearly defined it before. Below are the screenshots.

undif1.png

undiff2.png

Thanks for any help in advace!

3 replies

24-Ruby IV
October 20, 2011

I think by the definition the funktion f must be not C1(...) but C1*(...).

And see the F6 function in attach.

1-Visitor
October 20, 2011

Hi Valery,

Did you change the F6 function? Doesn't fix the problem though. I am using Mathcad 14.

12-Amethyst
October 20, 2011

It's difficult to tell without the Mathcad file, could you attach the file?

In the function, base is in the argument list, so doesn't matter if defined before as far as that equation goes.

Looks like the Minimize failed, and that's why Lambda, and the rest of the variables as well, are no longer defined?

Did you provide in a solve block and provide guess values?

1-Visitor
October 20, 2011

Hi again Wayne,

yea. The Mathcad file is attached at the bottom of the original post. I put it in .rar format. I attached it in the post again. It is "fitting.rar"

How did you know the Minimize failed?

I thought the values I defined earlier are the guess values?

Thanks!

19-Tanzanite
October 20, 2011

When you evaluate the function F6 for the given parameters, it's complex. This causes Minimize to fail, with a completely misleading error message.

You should always plot the data and the estimated function before performing the fit. That way you have some idea of how close you are.

Minimize is not really the best way to fit the data, but we can come back to that when you have fixed the function F6 and/or the estimated parameters so that the estimated function is at least reasonably close to the data.

1-Visitor
October 20, 2011

Hi Wayne,

Huh. Why are there zeroes at the end of my SSR? And there is a F6(...) = (8) there too. I don't know how it got there. It doesn't show in my original window. Starting to think if my Mathcad has issues.

I am trying to minimize the parameters, not to solve for them. That's why I used Minimize and not Find. I am trying to minimize the parameters in SSR, which is a chi^2 function. Then apply those values to TotalAreaFit and PowderPartArea. Minimize doesn't work?

Ian

PS: Was your post deleted or something? I tried to reply to it but it disappeared. Did you delete it?

12-Amethyst
October 20, 2011

Ian, yes I deleted my post because right after I posted, I realized the Find() was of no value. I started to look at the behavior of the SSR function with respect to each variable to see if there were any problems, I did not finish, but did find the SSR has a jump at Beta as it approaches 0. So perhaps you need to but some limits on some of the variables.

1-Visitor
October 21, 2011

Hi Wayne!

Hmm. I was thinking it could be how I entered my 'f' function early on in the program. I attached some screenshots on where I think could have entered the function incorrectly. Could you double check if this is the case? This is the same case as my 'multiple if' post earlier.

Thanks!

part_1.png

part_2.png