Quantcast
Channel: Latest Discussions - COMSOL Forums
Viewing all articles
Browse latest Browse all 26527

Heavyside-Function and Divison by Zero

$
0
0
Hi

I stumble realising a Gaussian-beam like in the tutorial model "Nanorods" (using RF-module).

Problem:
Part of the wave function has a singularity: constant/z
Solution in tutorial:
Define a piecewise-function covering the singularity like:
z<-z0 : constant/z
-z0<z<z0 : constant/z0
z0<z : constant/z

But in contrary to the example I need frequency-dependent borders respectively frequency-dependent z0 [Z0(freq)].
As this is not possible with piecewise-function (i guess) i tried a sum of Haevyside-functions (like recommended in several forum-posts):
(constant/z)*flc2hs(-z-Z0(freq),range)
+(constant/z0)*flc2hs(z+Z0(freq),range)*flc2hs(-z+Z0(freq),range)
+(constant/z)*flc2hs(z-Z0(freq),range)

Does the same when being plotted from the Global_Definition/Anayltics-Node. Produces also no error when the model is being computed. But trying to plot from Solution1-Node producing the error:
Evaluation of result expression failed
Error in user-defined function
Failed to evaluate expression

This error does not occur if the (constant/z)-function is replaced by a non-singularity-function. So plotting after computing messes somehow with the Heavyside-function.

Any idea or experience how to get that work? This starts to erode my self-confidence.

Thanks for any help


edit: Problem was, i think, not the above expression but the fact that inside of the wave-function something gets divided by that expression. And i think the smoothening of the heavyside-function leads to a zero at the singularity. And then again divided by zero ^.^ -> error
Though i am not sure.

But in this case using the inverse function just works fine : )

Viewing all articles
Browse latest Browse all 26527

Trending Articles