Simulink: Need to update variables used in simulink differential equation solver
2 views (last 30 days)
Show older comments
Julian Thrash
on 27 Jul 2020
Answered: Fangjun Jiang
on 27 Jul 2020
Hi,
I need to solve a differential equation in Simulink that has time varying elements I need to update and record in an array in the MATLAB workspace. I'm trying to solve a system of lumped differential equations.
My equation solves for a pressure in a cardiovascular system: dpe1 = e1(t)*(I1(t)+pe1(t)*(1/(e1(t))^2*de1(t)))
The variables e1, I1, pe1, and de1 are all varying with time and need to be updated to solve the equation at specific instances in time during the simulation (i.e. dpe1 at time 0 needs e1(t=0), I1(t = 0), pe1(t = 0), and de1(t = 0). I1(t) will have it's own seperate function that I'll have to recreate in another section of my code.
I need help updating these variables in my differential equation and recording them in the workspace for future use. I'm relatively new at simulink and could use some help figuring out how to connect signals and data values in my simulations. I would greatly appreciate any help with this.
I'll attach an image of the simulation with the values I need to have updated circled. Please let me know if you need any additional information.
0 Comments
Accepted Answer
Fangjun Jiang
on 27 Jul 2020
Do you have the formula of the function? For example, if pe1(t)=sin(t), you just use the "Fcn" block, specify it as "sin(u)" and feed the Clock signal.
so just contruct the fucntion using whatever block based on the function formula of time t.
0 Comments
More Answers (0)
See Also
Categories
Find more on Array and Matrix Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!