Simple Calculation
Cory K
when I try to compile the following macro:
#pragma rtGlobals=1 // Use modern global access method.
Menu "Macros"
"DO Calibration Point Calculator", PointCalculator()
End
Function PointCalculator()
variable A = 15, tau = 15, x0 = 23, y0 = -0.5
variable lifetime = 60, concentration = 20
Prompt A, "A : "
Prompt tau, "Tau : "
Prompt x0, "x0 : "
Prompt y0, "y0 : "
DOPrompt "Coefficients", A, tau, x0, y0
Prompt lifetime, "Enter a lifetime value : "
DOPrompt "Lifetime Input", lifetime
concentration = y0 + A*exp(-(lifetime-x0)/tau)
Menu "Macros"
"DO Calibration Point Calculator", PointCalculator()
End
Function PointCalculator()
variable A = 15, tau = 15, x0 = 23, y0 = -0.5
variable lifetime = 60, concentration = 20
Prompt A, "A : "
Prompt tau, "Tau : "
Prompt x0, "x0 : "
Prompt y0, "y0 : "
DOPrompt "Coefficients", A, tau, x0, y0
Prompt lifetime, "Enter a lifetime value : "
DOPrompt "Lifetime Input", lifetime
concentration = y0 + A*exp(-(lifetime-x0)/tau)
Basically, heres what the macro is supposed to do:
- get an input from the user "lifetime". This should just be some numerical value
- use the formula y = y0 +A*exp(-(x-x0)/tau)
- assign this y value to the variable "concentration"
Do you know why I am getting this error?
Have you missed putting an "end" statement for the function or was this just a typo in posting?
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
February 11, 2009 at 10:36 am - Permalink
I can write all that and then leave off the easy part.
Oh well, thanks for catching that.
February 11, 2009 at 11:57 am - Permalink