| Author |
Message |
cedance
Joined: 24 Oct 2003 Posts: 704 Helped: 28 Location: Germany
|
22 Mar 2007 16:38 solving piecewise functions using ode in matlab!! |
|
|
|
Hi,
suppose, i define a function f'(t) = t at say [0,1] and f'(t) = tē at (1,4] that is,
f'(t) = t 0<=t<=1
= tē 1<t<=4
i need to find the numerical solution to this differential equation using matlab. Please suggest me how to do this. I couldnt find anything out of the help from matlab.
thanks,
cedance.
|
|
| Back to top |
|
 |
drabos
Joined: 03 Jan 2006 Posts: 425 Helped: 26
|
23 Apr 2008 16:26 solving piecewise functions using ode in matlab!! |
|
|
|
I have just read now your topic.
Well, it is not numerical, but what about Laplace transformation?
And what about if you define the function with the aid of heaviside step function?
e.g.: [0,1] : Heaviside(t)-Heaviside(t-1)
|
|
| Back to top |
|
 |
drabos
Joined: 03 Jan 2006 Posts: 425 Helped: 26
|
25 Apr 2008 19:16 solving piecewise functions using ode in matlab!! |
|
|
|
or you write two equations, as you did .
You know the initial conditions for the first equation, so you can calculate the solution of the first equation. You will get the initial values for the second equation, then you can calculate the second equation and after you can merge the two solution vectors. What about this approach?
|
|
| Back to top |
|
 |