MATLAB Answers


Algebric loop in simulink

How to make algebric loop in simulink,

I have requirment where I have to add two constant numbers with increment of 1, a=constant b=constant

a1=a+b; a2=a1+b; a3=a2+b; a4=a3+b;

  1 Comment

I am trying to do it in simulink blocks

3 Answers

Answer by Azzi Abdelmalek
on 9 Nov 2012
 Accepted answer

use this model


What do you mean I want to set a time?

How can I put infinite loop in simulink

just set stop time to inf (simulation parameter)

Answer by Muruganandham Subramanian on 9 Nov 2012
Edited by Muruganandham Subramanian on 9 Nov 2012

You can use 'from' and 'goto' blocks from simulink-->signal routing library.


But how to update a1 to a2 to a3,I am trying for loop ,,but not getting how to work with for loop subsystem

a1=a+b( for a1(tag name) use goto block to store the value(either 'local' or global), then do continuously..

This doing continuosly am not getting,how to continue it with increment of a1 a2 a3 a4

Answer by Anthony Poulin
on 9 Nov 2012

Hey, in your case you don't have an algebrical loop because your operations are in ''cascade'' (english translation of a french word, I don't know if it's understandable). If you want to create one, you have to make an operation like a1 = a + a1.


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!