Something about 'SetCustomExcite'

How to use openEMS. Discussion on examples, tutorials etc

Moderator: thorsten

Post Reply
Posts: 12
Joined: Tue 25 May 2021, 03:38

Something about 'SetCustomExcite'

Post by Katrina » Tue 09 Nov 2021, 04:26

hi guys :
Today, I want to use setcustomexcite() to set a custom excitation source signal, as shown in the example "ramped sinus excite" in the tutorial, but when running the script, matlab reported the following error. Then I directly used the example in the tutorial as my excitation source, and the program still didn't run successfully. I want to ask the author or an experienced friend, What's the problem?
This is my fault:
Create FDTD operator (compressed SSE + multi-threading)
/home/caolibao/opt/openEMS/share/openEMS/matlab/private/../../../../bin/ "Sphere_RCS.xml" : Killed
错误使用 invoke_openEMS (line 50)
openEMS binary exited with error-code 137

出错 RunOpenEMS (line 181)

出错 RCS_Sphere (line 95)
RunOpenEMS( Sim_Path, Sim_CSX);

And this is my code:
FDTD = SetCustomExcite( FDTD, f0, '50000*1.3*(exp(-1*40000000*t)-exp(-1*600000000*t))');

This is the code in the tutorial:

function FDTD = SetCustomExcite(FDTD,f0,funcStr)
% function FDTD = SetCustomExcite(FDTD,f0,funcStr)
% f0 : nyquist rate
% funcStr : string describing the excitation function e(t)
% see also SetSinusExcite SetGaussExcite
% e.g for a ramped sinus excite...
% T = 1/f0;
% FDTD = SetCustomExcite(FDTD,1e9, [ '(1-exp(-1*(t/' num2str(T) ')^2) ) * sin(2*pi*' num2str(f0) '*t)' ]);
% openEMS matlab interface
% -----------------------
% author: Thorsten Liebig


Posts: 9
Joined: Wed 03 Jun 2020, 10:36

Re: Something about 'SetCustomExcite'

Post by hannesko » Tue 09 Nov 2021, 14:40

Hi Katrina,

I guess your Nyquist rate f0 is not appropriate. I tested your excitation source
FDTD = SetCustomExcite( FDTD, f0, '50000*1.3*(exp(-1*40000000*t)-exp(-1*600000000*t))');
and for me it worked with f0=1e6 ... with 1e9 it didn't!


Posts: 12
Joined: Tue 25 May 2021, 03:38

Re: Something about 'SetCustomExcite'

Post by Katrina » Wed 10 Nov 2021, 05:14

Hi Hannes;

At your suggestion, I changed 1e9 to 1e6, but I guess it's not just the problem here, because the program still doesn't run successfully. If I can, can I see your test code


Posts: 1477
Joined: Mon 27 Jun 2011, 12:26

Re: Something about 'SetCustomExcite'

Post by thorsten » Wed 10 Nov 2021, 08:04

Please correct me if I'm wrong, but this looks to start with a sharp jump to a max value?? This is a bad idea... The excitation should always start smooth and never have jumps or steps that introduce high frequency oscillations!
In general, using custom excitation correctly is not easy and you will need lots of experience and really know what you do...

best regards

Post Reply