# Xcos simulation example error

**URL:** <https://scilab.discourse.group/t/xcos-simulation-example-error/973>\
**Category:** Xcos\
**Created:** [June 13, 2025, 7:10am UTC](https://scilab.discourse.group/t/xcos-simulation-example-error/973 "2025-06-13T07:10:26Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hotep22](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/hotep22/32/856_2.png) [@Hotep22](https://scilab.discourse.group/u/Hotep22)\
**Post date:** [June 13, 2025, 7:10am UTC](https://scilab.discourse.group/t/xcos-simulation-example-error/973/1 "2025-06-13T07:10:26Z")

</div>

Xcos Simulation Help

Hello scilab/ xcos pros,

I recently started learning about xcos, starting with the basics of graphical simulations. So far most of the examples have been a breeze except for this current example of the video linked below. I am stuck on the first part on the single ( input/0utput of the scope) from 0 min to about 8min mark. I have coded the cubeit function example and it compiles correctly in scilab. I have also made all the necessary parameters adjustments and yet I am getting an error in my attempt to produce a simulation. The graph display pops up but nothing displays. I don't know where to even start the troubleshoot.

Just for context I have a bit of coding background especially in wxmaxima, and as well as some basic knowledge of matlab and some of its other varients i.e. octave, scilab, freemat etc...

Here's the video link: [https://youtu.be/K9DC-dNWuNE?si=IvmCL8VLNk83y36r](https://youtu.be/K9DC-dNWuNE?si=IvmCL8VLNk83y36r)

Also for those of you who have mastered xcos, is there any good sources of materials that you can recommend to make the deep learning of xcos easier? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [June 13, 2025, 12:26pm UTC](https://scilab.discourse.group/t/xcos-simulation-example-error/973/2 "2025-06-13T12:26:49Z")

</div>

Hello and welcome to Scilab’s Discourse !

Can you save and post here your Xcos diagram (`*.zcos` file), as well as the script defining the `cubeit` function ?

S.

---

<div class="post-metadata">

**Author:** ![Hotep22](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/hotep22/32/856_2.png) [@Hotep22](https://scilab.discourse.group/u/Hotep22)\
**Post date:** [June 13, 2025, 7:21pm UTC](https://scilab.discourse.group/t/xcos-simulation-example-error/973/3 "2025-06-13T19:21:29Z")

</div>

Hello Mottelet  
Find attached all the info you requested. Hope it helps in solving this little road block.

 ![xcossimfail](https://global.discourse-cdn.com/free1/uploads/utc/original/1X/8beb8c1f01416445758b115ace414c5cf2a0a774.jpeg)

[cubeit.sci](https://scilab.discourse.group/uploads/short-url/6Qq7xtZTX3D7vSfAi8TEPI5FWmQ.sci) (46 Bytes) ===\> scilab script  
[cubeit.zcos](https://scilab.discourse.group/uploads/short-url/h5CxBdKMl329YWwr8T2BWQ0vdXP.zcos) (2.9 KB) ====\> xcos script

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [June 13, 2025, 7:58pm UTC](https://scilab.discourse.group/t/xcos-simulation-example-error/973/4 "2025-06-13T19:58:06Z")

</div>

Scilab is case sensitive, in cubeit.sci

```auto
function y = cubeit(p)
	y = P^3;
endfunction

```

p should be lowercase (or uppercase) everywhere, here you mixed both.

S.

---

<div class="post-metadata">

**Author:** ![Hotep22](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/hotep22/32/856_2.png) [@Hotep22](https://scilab.discourse.group/u/Hotep22)\
**Post date:** [June 14, 2025, 7:29am UTC](https://scilab.discourse.group/t/xcos-simulation-example-error/973/5 "2025-06-14T07:29:54Z")

</div>

Thank you Mottelet. It worked! I can not believe this small error was giving me such a headache. I need to be more attentive to my codes from now on. I appreciate you.  
P/S  
To the last part of my question, is there any materials you can recommend for a deeper dive in xcos simulation? so far most tutorials I am seeing on YouTube (before getting stuck) are pretty basic form of simulation. My long term goal is build enough skills to be able to dive deeper into more advanced domain of real time system simulations…

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [June 14, 2025, 10:12am UTC](https://scilab.discourse.group/t/xcos-simulation-example-error/973/6 "2025-06-14T10:12:53Z")

</div>

I think that the error could have been seen by leaving the mouse cursor above the blinking triangular panel with the exclamation mark. Concerning resources about Xcos there are at least two books : [Scicos \> Book: Modeling and Simulation in Scilab/Scicos](http://www.scicos.org/book.html)  
[https://www.researchgate.net/publication/343472236\_Introduction\_to\_Xcos\_A\_Scilab\_Tool\_for\_Modeling\_Dynamical\_Systems](https://www.researchgate.net/publication/343472236_Introduction_to_Xcos_A_Scilab_Tool_for_Modeling_Dynamical_Systems)

---

<div class="post-metadata">

**Author:** ![cfuttrup](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@cfuttrup](https://scilab.discourse.group/u/cfuttrup)\
**Post date:** [June 14, 2025, 2:31pm UTC](https://scilab.discourse.group/t/xcos-simulation-example-error/973/7 "2025-06-14T14:31:14Z")

</div>

Hi hotep22

> Also for those of you who have mastered xcos, is there any good sources of materials that you can recommend to make the deep learning of xcos easier? Thanks in advance!

> **[Introduction to Xcos: A Scilab Tool for Modeling Dynamical Systems (English...](https://www.amazon.fr/-/en/Arvind-Verma-ebook/dp/B08FG9LT1Y)**
>
> Introduction to Xcos: A Scilab Tool for Modeling Dynamical Systems (English Edition) eBook : Verma, Arvind, Verma, Rachna: Amazon.fr: Kindle Store

With kind regards,  
Claus

---

<div class="post-metadata">

**Author:** ![Hotep22](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/hotep22/32/856_2.png) [@Hotep22](https://scilab.discourse.group/u/Hotep22)\
**Post date:** [June 15, 2025, 8:30pm UTC](https://scilab.discourse.group/t/xcos-simulation-example-error/973/8 "2025-06-15T20:30:08Z")

</div>

ah I see. Thanks.  
I appreciate the book recommendation! 🙏

---

<div class="post-metadata">

**Author:** ![Hotep22](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/hotep22/32/856_2.png) [@Hotep22](https://scilab.discourse.group/u/Hotep22)\
**Post date:** [June 15, 2025, 8:34pm UTC](https://scilab.discourse.group/t/xcos-simulation-example-error/973/9 "2025-06-15T20:34:57Z")

</div>

Wow! This is one is really good 👌. Plenty of graphical examples and a walk through of the platform showing where different blocks are located. Perfect and concise introductory material for an xcos noobie such as myself ( 🤣). I appreciate you for this.

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [June 16, 2025, 7:12am UTC](https://scilab.discourse.group/t/xcos-simulation-example-error/973/10 "2025-06-16T07:12:02Z")

</div>

Mathematically speaking, the second equation on the book cover has no sense. Considering the system which is considered, and the depicted implementation, it should be written

\ddot y = -k\dot y, \mbox{ for }y\leq 0.

Moreover, the proposed implementation is questionable, because the in/then/else block checks the condition only at clock tics, hence the resulting trajectory depends on the clock period. You can check (use the diagram `bounce.zcos` below) that actual value of simulated y is negative when “bouncing”, and worse, that extending the simulation time shows a non convergence of y (there is a slow linear drift towards negative values).

I am sorry to say that, but such books are not thoroughly reviewed.

Book’s bouncing ball diagram: [bounce.zcos](https://scilab.discourse.group/uploads/short-url/lJu8iIWB1pdkA0szfg69jw5MURB.zcos) (3.6 KB)

There are better implementations, see e.g. the Xcos/Modelica demos/Bouncing ball demo.

S.

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [June 16, 2025, 8:43am UTC](https://scilab.discourse.group/t/xcos-simulation-example-error/973/11 "2025-06-16T08:43:19Z")

</div>

The second link I provided gives free access to the book content on [researchgate.net](http://researchgate.net) (don’t buy it on Amazon…).

S.

---

<div class="post-metadata">

**Author:** ![cfuttrup](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@cfuttrup](https://scilab.discourse.group/u/cfuttrup)\
**Post date:** [June 16, 2025, 3:24pm UTC](https://scilab.discourse.group/t/xcos-simulation-example-error/973/12 "2025-06-16T15:24:59Z")

</div>

Hi Stéphane

I am interested in a full link to the book on researchgate.

With kind regards,  
Claus

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [June 16, 2025, 3:28pm UTC](https://scilab.discourse.group/t/xcos-simulation-example-error/973/13 "2025-06-16T15:28:46Z")

</div>

Well, didn’t I already gave it above ?

---

<div class="post-metadata">

**Author:** ![cfuttrup](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@cfuttrup](https://scilab.discourse.group/u/cfuttrup)\
**Post date:** [June 16, 2025, 4:07pm UTC](https://scilab.discourse.group/t/xcos-simulation-example-error/973/14 "2025-06-16T16:07:15Z")

</div>

Hi Stéphane

My apology. I see it now. Either your post ‘sneaked’ in front of my own post, or the post was modified later to include the link to researchgate.

With kind regards,  
Claus

---

<div class="post-metadata">

**Author:** ![Hotep22](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/hotep22/32/856_2.png) [@Hotep22](https://scilab.discourse.group/u/Hotep22)\
**Post date:** [June 16, 2025, 7:44pm UTC](https://scilab.discourse.group/t/xcos-simulation-example-error/973/15 "2025-06-16T19:44:30Z")

</div>

> [@cfuttrup](#):
>
> [Introduction to Xcos: A Scilab Tool for Modeling Dynamical Systems (English Edition) eBook : Verma, Arvind, Verma, Rachna: Amazon.fr: Kindle Store](https://www.amazon.fr/-/en/Arvind-Verma-ebook/dp/B08FG9LT1Y)

Good to know. Thanks. I already seen the searchgate link on my own search from the title that was provided. The searchgate link unfortunately is a complete txt. I think It only has 100pages of about 400pages total of the material. Still not bad though. Just getting a guide of where things (tool blocks) are located and and descriptions of what they do is a great start. From then Its just a matter of getting down and practice practice and practice!

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [June 17, 2025, 6:27am UTC](https://scilab.discourse.group/t/xcos-simulation-example-error/973/16 "2025-06-17T06:27:28Z")

</div>

Hello Claus,

You’re right the pdf stops at page 80 !

S.
