LambertW-function can't solve for unitless variables and vector with more than 9 values
- March 2, 2020
- 4 replies
- 4577 views
Dear community,
I am trying to calculate the current I dependent of V of a photovoltaik cell in . To solve this equation I am using the LambertW function. Unfortunately, I ran into two problems that I have not figured out yet:
1. I wanted to define the argument LambertW-function W(z) in symbolic form, i.e. I wanted to type out equation I want to use for z inside the parentheses of the LamberW-function. I made sure that all the units in the function cancel each other out. Nonetheless I receive an error, that "This value has unit voltage, but needs to have unit unitless". If I just solve the argument z of the function the value is unitless. The expression W(z) can be solved though however if I provide unitless variables. I achieved this by dividing each variable by its respective unit, therefore making the input unitless. This bothers me a little though since I haven't found the reason for this problem or how to solve it.
2. I wanted to plot the function W in depence of V. To do this I defined a vector U[k with kmax steps for my voltage. The solver can't finde a solution if kmax is greater than 8. Even in my simple example I only get "NaN" as a result if kmax is 9. I didn't change the maximim and minimum voltages, just the step width. However if I calculate the values of the argument z of the LambertW-function before I calculate W(z) I can use a kmax greater than 8.
Does anybody have an idea why my original solution doesn't work and why I can't calculate more than 9 values when using kmax=8 ? Thank you very much in advance!

