MATLAB help for modelling with changing variables.

In summary, the conversation discusses using MATLAB and ode23s to solve equations with certain variable values for specific time intervals. The suggested solution is to split the problem into two parts and use the solution from the first part as the initial condition for the second part while setting the variable to zero in between.
  • #1
jr01
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!
 
Physics news on Phys.org
  • #2
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 to MATLAB help for modelling with changing variables.

1. What is MATLAB and how can it help with modelling?

MATLAB is a programming language and software environment commonly used in science and engineering for data analysis, visualization, and mathematical calculations. It has a variety of tools and functions that can assist with modelling, such as simulation and optimization algorithms.

2. Can MATLAB handle changing variables in a model?

Yes, MATLAB has the capability to handle changing variables in a model. It allows for the creation of dynamic models that can be updated with new data and parameters as needed.

3. How do I input changing variables into a model using MATLAB?

There are several ways to input changing variables into a model using MATLAB. One way is to use the "input" or "prompt" functions to allow the user to input the values during runtime. Another way is to create a matrix or vector containing the changing variables and use MATLAB's indexing capabilities to update the model accordingly.

4. Are there any limitations to using MATLAB for modelling with changing variables?

While MATLAB is a powerful tool for modelling, it does have some limitations when it comes to handling changing variables. For instance, it may not be the best option for very large and complex models, or for models that require real-time updating. In these cases, other software or programming languages may be more suitable.

5. Is there a user-friendly interface for modelling with changing variables in MATLAB?

Yes, MATLAB offers a user-friendly interface called the Simulink tool for modelling and simulating dynamic systems with changing variables. Simulink provides a graphical environment where users can build models using blocks and connect them to simulate the behavior of the system over time.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
597
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
32
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
Back
Top