Asked by Beenish Mazhar
on 5 Dec 2012

I am having a model in simulink uploaded at:

<http://www.freeimagehosting.net/79moh. >

In the first iteration the model should take value from matlab mfile and calculate error for Pid as e=r-i where 'i' is the value taken from matlab mfile but after that it should take feedback and calculate the error as e=r-y where 'y' is the value of feedback from space state. How can I do that in simulink. Any guidance?

Answer by Muruganandham Subramanian
on 5 Dec 2012

Edited by Muruganandham Subramanian
on 5 Dec 2012

Accepted answer

step1:Initialize all i/p data in m-file & variable 'i'

step2: use 'sim()' command to run your model

step3: store the value of 'y' in baseworkspace by 'To workspace' block from model

step4:calculation

Show 5 older comments

Muruganandham Subramanian
on 6 Dec 2012

constant->'(+-)' block->(-)simin(Insteadof this) %simin is not needed

From output(i.e.simout3)--> use **'unit delay'**(1/z)block from simulink library, initial codition as **'0'**(i.e.zero) in delay block and then connect to (-)sign of add block

Beenish Mazhar
on 6 Dec 2012

Muruganandham Subramanian
on 6 Dec 2012

**user specified**. so you can give any value like 0 or 2 or 5 or etc...

Opportunities for recent engineering grads.

## 0 Comments