How to use the Dirac Delta Function in ode45?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello, I am trying to use matlab to plot the phase plane of an equation. I have written the correct equation in the code, but for some reason I have received errors.
Can someone please take a look?
This runs the function 'radio2'
[t radiot1] = ode45('radio2', [0:0.01:20], [.6 ;.4]);
plot(radiot1(:,2),radiot1(:,1))
'radio 2' is defined as
function dz = radio2(t, cancer)
a=1;
b=1;
c=3;
d=1;
e=2;
f=2;
D=2;
T=1.3502;
alphax=.33;
betax=.02;
alphay=.06;
betay=.02;
syms j
x=cancer(1);
y=cancer(2);
dxdt = a*x - b*x^2 - c*x*y-x*symsum((alphax*D+betax*D^2)*dirac(t-j*T),j);
dydt = d*y - e*y^2 - f*x*y-y*symsum((alphay*D+betay*D^2)*dirac(t-j*T),j);
dz = [dxdt; dydt;];
I receive the following errors
1 comentario
Walter Roberson
el 16 de Dic. de 2011
The error didn't show up. If you need to upload it as an image, please see http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
Respuestas (1)
Walter Roberson
el 16 de Dic. de 2011
Your radio2() is going to be trying to return a symbolic object, which ode45 is not going to be able to process.
symsum() returns a symbolic object, even if the output is numeric. Use double() on the symsum() to convert numeric symbolic objects to double precision.
0 comentarios
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!