MATLAB help for modelling with changing variables.

Click For Summary
SUMMARY

The discussion focuses on using MATLAB's ode23s function to model a variable that changes values over specified time intervals. The user seeks to set a variable to 10 for the interval [0,10] and to 0 for the interval [10,375]. A suggested solution involves solving the problem in two parts, using the initial conditions from the first part to inform the second part, effectively managing the variable's value transition. The function provided is 'CaMito2_p1', which utilizes ode23s to solve the equations defined in 'CaMito2_p'.

PREREQUISITES
  • Basic understanding of MATLAB programming
  • Familiarity with numerical solvers, specifically ode23s
  • Knowledge of initial conditions in differential equations
  • Concept of piecewise functions in mathematical modeling
NEXT STEPS
  • Learn how to implement piecewise functions in MATLAB
  • Research the use of initial conditions in MATLAB's ode solvers
  • Explore advanced features of ode23s for more complex modeling
  • Study the structure and syntax of MATLAB functions for better coding practices
USEFUL FOR

This discussion is beneficial for beginners in MATLAB, particularly those interested in numerical modeling and differential equations, as well as experienced users looking to refine their skills in managing variable states over time intervals.

jr01
Messages
2
Reaction score
0
Hi,

I'm new to MATLAB and programming, but I hoping to find out if I can have a variables in my program take on certain values only for certain time intervals. For example, I am using ode23s to solve some equations for me, but for the time interval [0,10] I would like one of the variables from the equations to be 10, but from [10, 375] the variable should be 0.

function CaMito2_p1
[t,x]=ode23s('CaMito2_p',[0,375],[500e-9,0.9e-6]);
plot(t,x(:,1))
end

(Equations found in CaMito2_p)

Can anyone help me out? Thanks!
 
Physics news on Phys.org
don't know MATLAB or ode23s, but...

do you solve with initial conditions?
can you solve your problem in two parts? [0,10] and [10,375] ? and use the solution from the first part as the initial condition for the second part? and in the middle, set to zero the one variable that you are talking about?
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 10 ·
Replies
10
Views
3K