
"Bad MatrixOPs token" error

Jakub
Dear Colleagues,
When I'm trying to execute the following code:
Function Kohler() Variable T = 320, k = 1.38E-23, o = 72.64E-3, n = 6.348E28, Ms = .092, Mw = .018, p = 2600, i = 1, ro=0, Vol=0, mass=0, m=0 make /O/N=1000 r0 SetScale/P x, 1e-7, 1e-6, r0 r0=x+9e-7 ro=0.5e-6; //initial radius of a dry droplet Vol=(4/3)*pi*ro^3; mass=Vol*p; m=mass/Ms; MatrixOP/O/FREE E=(exp((2*o)/(n*k*T*r0)))*(1/(1+((i*m*Mw)/(Ms*(((4/3)*pi*(powR(r0,3))*p)-m))))); end
I'm getting the bad matrixOPs token error. Is it because I'm trying to use variables in the MatrixOP call? There is one wave in there, which is the r0 1D Wave. Should I make waves instead of variables for it to work? I'm using Igor 8.04.
Kind regards,
Jakub
Your wave isn't a matrix, and there is no real reason to use MatrixOp for that expression.
Here is your code rewritten as a regular wave assignment statement:
Note the TODO item about the number type of the output wave.
I also changed two of your variable names, p->p_var and i->i_var. p and i are Igor function names. If you create a variable with the same name then the variable is used instead of the Igor function with the same name, which is confusing (and can lead to an incorrect result).
November 2, 2020 at 04:55 am - Permalink
Hello Jakub,
The expression you wrote may have the advantage that it is very readable but it is computationally very inefficient. MatrixOP does not care about the efficiency but you ran into problems with the divisions where you need to use the rec() function. Here is a quick attempt at modifying your code:
I hope it helps,
AG
November 2, 2020 at 03:06 pm - Permalink
In case you are interested in the evolution with temperature.
November 2, 2020 at 06:12 pm - Permalink
To add detail to AG's comment, for the "/" operator the MatrixOP help states:
November 3, 2020 at 05:38 am - Permalink