Page 1 of 1

How to use SetCustomExcite for a shifted signal?

Posted: Wed 17 Mar 2021, 05:54
by jjmaloss

I am trying to add shifted signals of type sin(ω(σ-|t|)) in [-σ,σ] and 0 elsewhere. I call this function Umin(t). I am using SetCustomExcite. The issue is that these pulses *are shifted* in time. For example, I would like to perform a simulation where I consider say Umin(t-σ) + Umin(t+3σ) (two isolated pulses). To define Umin(t+3σ), I tried to use the following string 'if(2σ<t<4σ,sin(ω(σ-|t-3σ|),0)' where ω, σ are hard-coded (no conversion from variable to string). I noticed that I got a similar behaviour to 'if(t<4σ,sin(ω(σ-|t-3σ|),0)' and thus the first inequality is not met. However, I get no syntax error. If I try (t>2σ)&(t<4σ) (the AND boolean function ), I get a syntax error without telling me what is wrong.

Am I missing something?

Thank you for the help.

Re: How to use SetCustomExcite for a shifted signal?

Posted: Thu 18 Mar 2021, 22:16
by jjmaloss
Actually, the solution is pretty simple:

do '(if (abs(t-5σ)<σ),1,0)' for a rectangular pulse in [4σ,6σ]. This σ needs to be hard coded to a numerical value or use the unfriendly function num2string(). As a proof of concept, please find the code that generates 2 well separated rectangular pulses.