MATLAB Answers

how to change the integrator initial conditions?

6 views (last 30 days)
Trevor Hutchinson
Trevor Hutchinson on 5 Feb 2020
Commented: stozaki on 8 Feb 2020
In simulink I am using the integrator block. I know that the initial condition defaults to t=0. How would I change that so my initial condition starts at t=9?

  0 Comments

Sign in to comment.

Answers (1)

stozaki
stozaki on 5 Feb 2020
Hello,
ret = find_system(bdroot(gcs),'BlockType','Integrator')
for N = 1:length(ret)
set_param(ret{N},'InitialCondition','9')
end
Please try its script.

  2 Comments

Trevor Hutchinson
Trevor Hutchinson on 5 Feb 2020
This isn't quite the issue I am having. I am trying to solve a 2nd order diff eq using two integrator blocks. The equation is piecewise meaning my initial conditions change with respect to time. For example my first equation has initial conditions at t=0, but then my second equation has initial conditions at t=9. This suggestion tells my code that at t=0 the solution is 9.

Sign in to comment.

Sign in to answer this question.

Products


Release

R2019a

Translated by