From: enjin enjin on
Hello. I'm pretty new to Matlab, and would most appreciate it if anybody could give me some pointers.

I am working on some rate equations which I've solved using the ode45 function. However, I now will want to put in a gaussian pulse into the equation -- BUT am getting really muddled as to how to incorporate gauspuls into the ode45. Both the extract of the current codes, along with what I hope to do, are shown below:

[t,y]=ode45('dynamic', [0 300e-12], [1e-18 1e-18]);

*******************
dy(1)=((alpha*P)/(h*f*L*area))-(Nb/ts)-(Nb/tn1);
dy(2)=((Nb*Vb)/(ts*Vw))-((Nw1-Nw2))/(tc)-(Nw1/tn1)-(G1*(1-epsilon*S)*S);

In the above, dy is solved, and is fed back into the main (which 'called' the 'dynamic').

So in this case, what I hope to do is, to put a gaussian pulse as the input P <-- in dy(1). However, under the first line where ode45 is mentioned, I have only declared the time range (up to 300pico seconds), along with the initial values for both dy(s).

In the help section (from Matlab), it says that: yi = gauspuls(t,fc,bw) returns a unity-amplitude Gaussian RF pulse at the times indicated in array t, with a center frequency fc in hertz and a fractional bandwidth bw, which must be greater than 0. The default value for fc is 1000 Hz and for bw is 0.5.

How do the two 'times' (i.e. time range for ode45, and time for gaussian) actually relates? i.e. how do I 'split' the gaussian such that the steps are the same?

I hope I'm making sense here. Would really appreciate any kind tips or assistance. Thanks for reading!