MATLAB help for modelling with changing variables.

  • MATLAB
  • Thread starter jr01
  • Start date
  • #1
2
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!!!
 

Answers and Replies

  • #2
1,065
54
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?
 

Related Threads on MATLAB help for modelling with changing variables.

Replies
16
Views
192K
Replies
2
Views
13K
Replies
0
Views
3K
Replies
7
Views
829
Replies
0
Views
2K
Replies
1
Views
5K
Replies
3
Views
8K
Top