0
votes

I'm using the simulink function block to simulate the differential equation xdot = -x+x^2 And at the same time, I'm generating the same function manually, using a multiplier and a comparator. both simulations use an integrator block to compute the derivative xdot where the initial condition of the integrator is set to an interval [-0.5:0.5:0.5].

I can not figure out why I'm getting different responses from these similar simulations ? notice that the manually build simulation response is the right one.

Here is the simulink model: diff equa model

1
Can you post what's in that link you referenced to the question itself?Dethariel
Ok, I watched your model and can't see any noise blocks or smth that has different values in different simulations... maybe I understood smth in wrong way?Mikhail_Sam
@Mikhail_Sam: Do you mean you're getting the same curves in the two scopes ? I don't! Please tell me which Matlab version you're using ?amin
@Dethariel : The model file is download-able from my Google drive account using that link : drive.google.com/file/d/0B5aPxuMLmixfLW0zb2VKQUktMUU/…amin

1 Answers

0
votes

AHA! I got this. Look at this (it's the simulation at the first timestep): enter image description here Now we can see the problem - Fcn block don't understand, that u is a vector! So it works with the first element of your vector only!

I found this strange and check in help: matlab official. And we can see this:

u — The input to the block. If u is a vector, u(i) represents the ith element of the vector; u(1) or u alone represents the first element.

So. I think bottom part of the model works like you want!