I have a simple circuit with a SawTooth voltage source in SystemModeler 12.0.

How would I add a noise component to a sawtooth waveform?

  • I have added a NormalNoise block named normalNoise1 to my model.
  • I can plot normalNoise1 in my output run.
  • I would like to add normalNoise1.y to the amplitude of my SawTooth source. In my case this would be 20 + normalNoise1.y.
  • When I tried using 20 + normalNoise1.y as an expression for the amplitude entry of the SawTooth source, I get an error.

My two questions are:

  • Is there a good reference for the syntax for the expression editor in SystemModeler? I have looked for some examples that use expressions but am not finding anything.
  • Is it even possible to use a noise block in this way?

1 Answer 1


You cannot write 20 + normalNoise1.y as the expression for the amplitude, since the amplitude is a parameter (something that you set once, and is constant during the whole simulation), and normalNoise1.y is a variable (changes during the simulation).

I'm not sure what you are trying to achieve. What does a sawtooth with a noisy amplitude look like? If you want the sum of a regular sawtooth and some noise, you can achieve that using three components:

  • Noise block (like you have)
  • Modelica.Blocks.Sources.SawTooth block (with a set amplitude, like 20)
  • Modelica.Blocks.Math.Add to add the two together
  • Modelica.Electrical.Analog.Sources.SignalVoltage to get the signal into your circuit
  • $\begingroup$ I don't believe that the Modelica.Blocks.Math.Add will work with the voltage signal type. I think the only solution is to write a custom C++ function. $\endgroup$ Commented Oct 23, 2019 at 14:39
  • $\begingroup$ You can find a number of examples of noisy sawtooth waves in Google images and the ElectricalEngineering exchange. $\endgroup$ Commented Oct 23, 2019 at 14:41
  • $\begingroup$ I edited my answer for how you could get a sawtooth signal into an electric circuit. $\endgroup$
    – Malte Lenz
    Commented Oct 23, 2019 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.