Setting Initial Conditions for ode45() with f(1.5) Known

In summary, the conversation is about setting the initial conditions for ode45(), a function in MATLAB. The user is having trouble with their current code and is seeking help to fix the error. Another user offers suggestions and the original user is able to fix the issue. The conversation then shifts to a different topic, with someone asking for help with a programming problem.
  • #1
TalonStriker
15
0
Hey guys,

I was just wondering if anyone knows how to set the initial conditions for ode45() if you know f(1.5) but NOT f(0)


Currently I have
>> ode45(f, [0 1 1.8 2.1], [1.5 .5])

But this creates the following error:

? Error using ==> funfun/private/odearguments
@(T,Y) (T-EXP(-T))/(Y+EXP(Y)) must return a column vector.


Thanks.
 
Physics news on Phys.org
  • #2
You should be able to solve on arbitrary time intervals [ta,tb] going forwards or backwards in time. Your error looks like it's coming from your function f. What does it look like?
 
  • #3
I was able to fix it. Apparently i was using / in f() instead of ./.

Thanks for your help.
 
  • #4
i'm novice to the MATLAB i want to do the quantization techniques in the MATLAB so please help me out.
 
  • #5
Hi There
I was wondering if anyone knows how to write pentadiagonal matrix of any dimension in Matlab with maindiagoanl 10, super diagonal 3, -3 and lower diagonal 2, -2.

Thanks
 
  • #6
Dear Friends,

I have a problem in MATLAB programming. I need to know how to correct this error,
Undefined function or method 'imp' for input arguments of type
'double'.

Error in ==> FilterRealizationRadar at 9
fil(i)=imp(n-i+1);

Please can anyone help this problem out?
Sincerely
Elangoven Sundrason Pillai (ESP)
 

What is ode45() and why is it important for setting initial conditions?

ode45() is a function used in MATLAB for solving ordinary differential equations (ODEs). It is important for setting initial conditions because it allows us to specify the starting point for the ODE, which is necessary for finding a solution.

What does f(1.5) represent in the context of setting initial conditions?

f(1.5) refers to the value of the function at the initial condition of t=1.5. This value is used as a starting point for solving the ODE with ode45().

Can I use a value other than 1.5 for setting the initial condition in ode45()?

Yes, you can use any value for setting the initial condition in ode45(). However, it is important to choose a value that is within the domain of the function and that makes physical sense in the context of the problem being solved.

What happens if the initial condition for ode45() is not specified?

If the initial condition is not specified, ode45() will use a default value of 0 for the initial condition. This may not always be appropriate for the given ODE, so it is important to specify the initial condition to get an accurate solution.

How do I know if the initial condition I have chosen is appropriate for solving the ODE with ode45()?

The initial condition should be chosen based on the physical context of the problem and should result in a solution that makes sense. It is also important to check the output of ode45() to ensure that the solution is accurate and does not contain any unrealistic values.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
865
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
0
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
Back
Top