0

I am currently working on Simulink/Matlab code the idea is to remove some Simulink blocks that annoy our developing team. We are fighting with State-Space Model. The configuration of mentioned block is presented as follows:

Configuration of State-Space Station

Our question is: Is there any way to rewrite this using pure Matlab scripts functions? We were trying some approaches with idss and ss models but so far we failed. We are not Matlab experts. This is the pseudo-code that we with will solve the problem, but we are not an experts in maths.

ss(A, B, C, D); [y, t, x] = initial(tmp, x0);

Mr.Nimelo
  • 316
  • 4
  • 17
  • You can model it manually with built-in derivative, product, sum and constant blocks and matlab function blocks with your own code. – Sairus Jun 02 '17 at 15:28
  • @Sairus Can you provide some additional informations about it, some simplified examples? – Mr.Nimelo Jun 02 '17 at 15:55
  • 1
    What you want is using the matlab-function block to replace the state-space block, right? the matlab-function block would need to solve the differential equation dx/dt=Ax+Bu. Solving that yields x(t) which you can use to calculate your y(t) which is the output. If you provide some example data for u(t) , A, B, C and D, I could try solving this issue for you. – Max Jun 02 '17 at 17:01
  • @Max Unfortunately I cannot give you this example data, because it very big chunk of data. Although I would very appreciate the help inline 'ss(A, B, C, D); [y, t, x] = initial(tmp, x0);' – Mr.Nimelo Jun 02 '17 at 17:21
  • Sorry, I'm not experienced with this kind of stuff either. I think if I had example data, I could figure it out, but I can't help you with this. – Max Jun 02 '17 at 19:07
  • What is the problem you are trying to overcome in writing your own block rather than using the built-in block? There are multiple ways the block could be "re-implemented" but I can't see how any of them are easier than just using the block itself. – Phil Goddard Jun 02 '17 at 21:16
  • Well, the problem is that we have a series of those blocks which could be executed in parallel. The idea is to write a Matlab code to use it inside parfor loop. Do you know any implementations of this problem? – Mr.Nimelo Jun 02 '17 at 21:19
  • So within a single simulation/model, at every time step, you want to run a parfor loop to execute some parts of the model in parallel? – Phil Goddard Jun 04 '17 at 05:29

0 Answers0