Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Dirac Delta Question
Replies: 11   Last Post: Mar 1, 2013 1:43 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Bruno Luong

Posts: 8,741
Registered: 7/26/08
Re: Dirac Delta Question
Posted: Jan 17, 2013 5:45 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Sam " <samnuzbrokh@yahoo.com> wrote in message <kd9r7h$38b$1@newscl01ah.mathworks.com>...
> Hey y'all, I'm very confused as to how to numerically incorporate dirac delta behaviour into my differential equation. Maybe I'm using a wrong approach? I keep getting error messages to no avail. Any advice would be greatly appreciated!
>
> function dirac
> close all
> clc; clear
>
> %Parameters:
> G=1.07;
> w=2*pi;
> w0=(1.5)*w;
> B=(w0)/4;
>
> % Initial Conditions
> y0 = [0,0];
>
> % Make a theta vs. time plot
> [t,y] = ode23(@f,[0 25],y0,[],G,w,w0,B);
>
> hold all
> plot(t,y(:,1))
>
> function dydt = f(t,y,G,w,w0,B)
> dydt = [y(2);-2*B*y(2)-(w0^2)*sin(y(1))+G*(w0^2)*cos(w*t)+dirac(t-5)];


- Solve ode on the interval t in [0,5),
- take y5 = y(t=5)+[0;1] as initial condition to solve ode on the interval t = (5,25]

Bruno



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.