Implementing dxdt in simulink

I am currently moving my system of 10 ODE's from a matlab script into a simulink setup.
From the matlab script I have a function which creates dxdt from my state variables. This can then be solved using the ODE15s in my case.
%%ODE function
dxdt = kinetics(t,x)
%code describing my system (ODE's) using x(1),x(2),x(3)... as state variables
then my function is given inital values and solved:
[t,y]= ode15s(@kinetics, t, init, options);
Then it is possible for me to plot the output y(t)
How do i transfer my ode function into simulink so it does the same thing?
Right now when i try, it says that it is missing information on the x vector (as it is not defined but solved using the ODE15s).
I have given an input (step) to produce som time steps (is this right?)
I am kind of new to simulink, so please let me know something is unclear :)
You can see a picture below:
Thanks in advance

2 Comments

Can you share your both m files?
Yes of course. Thank you so much :)

Sign in to comment.

Answers (0)

Asked:

on 2 Apr 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!