Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Please help with this equation, FDTD or simple integration problem

Subject: Please help with this equation, FDTD or simple integration problem

From: salman

Date: 26 Jun, 2011 08:04:05

Message: 1 of 5

Dear Friends,

Hi, i am having a problem. i have an equation;

dA(z,t)/dz=-a/2)*cos(B(z))*A(z,t)+a*sin(C(z))*F*(2t1-t2-t);

here B, C are function of z only, while A is function of z and t. others are constant. how may i plot this? just with using some ode solver? this function should give me the result of A as function of space and time. will some FDTD method be used here?

thanks alot for help.

Subject: Please help with this equation, FDTD or simple integration problem

From: Roger Stafford

Date: 26 Jun, 2011 22:03:04

Message: 2 of 5

"salman " <salmanabdullah9@gmail.com> wrote in message <iu6p5k$9p2$1@newscl01ah.mathworks.com>...
> Dear Friends,
>
> Hi, i am having a problem. i have an equation;
>
> dA(z,t)/dz=-a/2)*cos(B(z))*A(z,t)+a*sin(C(z))*F*(2t1-t2-t);
>
> here B, C are function of z only, while A is function of z and t. others are constant. how may i plot this? just with using some ode solver? this function should give me the result of A as function of space and time. will some FDTD method be used here?
>
> thanks alot for help.
- - - - - - - - - - - -
  You can regard this as an ordinary differential equation in z, with t being held fixed. For each possible value of t, if you have an initial condition for A(z,t) at some z, this differential equation can be solved over the desired range of z while holding t at that fixed value.

  I think it would be rather tedious carrying out such a process with numerous different t values using one of the 'ode' solvers, though that remains as a distinct possibility.

  In a sense this can also be regarded as a partial differential equation in t and z even though no partial derivative with respect to t occurs. I suspect - though I can't say for sure - that the 'pdepe' and 'pdeval' functions can be used to solve it. However, it would involve knowing just the same initial conditions for A(z,t) along a boundary of varying t values as above. According to the documentation, 'pdepe' "solves initial-boundary value problems for systems of parabolic and elliptic PDEs in the one space variable and time", and it looks as though your equation is a very special case of such an equation.

  If this latter interests you, I would recommend a very thorough study of the pertinent section in the documentation.

Roger Stafford

Subject: Please help with this equation, FDTD or simple integration problem

From: salman

Date: 27 Jun, 2011 00:22:04

Message: 3 of 5

"Roger Stafford" wrote in message <iu8aao$5j5$1@newscl01ah.mathworks.com>...
> "salman " <salmanabdullah9@gmail.com> wrote in message <iu6p5k$9p2$1@newscl01ah.mathworks.com>...
> > Dear Friends,
> >
> > Hi, i am having a problem. i have an equation;
> >
> > dA(z,t)/dz=-a/2)*cos(B(z))*A(z,t)+a*sin(C(z))*F*(2t1-t2-t);
> >
> > here B, C are function of z only, while A is function of z and t. others are constant. how may i plot this? just with using some ode solver? this function should give me the result of A as function of space and time. will some FDTD method be used here?
> >
> > thanks alot for help.
> - - - - - - - - - - - -
> You can regard this as an ordinary differential equation in z, with t being held fixed. For each possible value of t, if you have an initial condition for A(z,t) at some z, this differential equation can be solved over the desired range of z while holding t at that fixed value.
>
> I think it would be rather tedious carrying out such a process with numerous different t values using one of the 'ode' solvers, though that remains as a distinct possibility.
>
> In a sense this can also be regarded as a partial differential equation in t and z even though no partial derivative with respect to t occurs. I suspect - though I can't say for sure - that the 'pdepe' and 'pdeval' functions can be used to solve it. However, it would involve knowing just the same initial conditions for A(z,t) along a boundary of varying t values as above. According to the documentation, 'pdepe' "solves initial-boundary value problems for systems of parabolic and elliptic PDEs in the one space variable and time", and it looks as though your equation is a very special case of such an equation.
>
> If this latter interests you, I would recommend a very thorough study of the pertinent section in the documentation.
>
> Roger Stafford

Dear Roger,

Thanks alot,

i will try this one too, as you suggested. but the method that i have in mind is this;

the quantity A(z,t) in the equation is an output from a previous program. so i aim to solve this with FTCS or Lax etc, method, by which i just discretize the problem in z and do it for each value of t, though i have at most 20 t values. is it fine?

Would you suggest doing it by FDTD or not?

Subject: Please help with this equation, FDTD or simple integration problem

From: Roger Stafford

Date: 27 Jun, 2011 01:03:05

Message: 4 of 5

"salman " <salmanabdullah9@gmail.com> wrote in message <iu8ifc$o8p$1@newscl01ah.mathworks.com>...
> ....... the method that i have in mind is this;
> the quantity A(z,t) in the equation is an output from a previous program. so i aim to solve this with FTCS or Lax etc, method, by which i just discretize the problem in z and do it for each value of t, though i have at most 20 t values. is it fine?
> Would you suggest doing it by FDTD or not?
- - - - - - - - - - - -
  You have me greatly puzzled, Salman. Where you spoke of an ode solver which "should give me the result of A as function of space and time", I interpreted that as meaning that A(z,t) is the unknown in your problem, but now you say that "the quantity A(z,t) in the equation is an output from a previous program" which would indicate quite otherwise. If you had said that your B(z) or C(z) is an output, that would make more sense.

  If B(z) and C(z) can readily be defined in terms of a matlab function, there is no reason I can see for not using one of matlab's ode solvers. On the other hand, if B(z) and/or C(z) can only be defined for some predetermined set of discrete values, then that would probably call for some finite difference method of approximating the solution. Of course, the fineness of such discrete data may well determine the accuracy of your result.

  You should remember that having discrete data does not prevent you from using higher order difference schemes such as the Runge Kutta method if your discrete data is accurate.

  As for A(z,t) itself, please relieve my anxiety and tell me whether it is an unknown, or if it is not, what it is you are trying to solve for.

Roger Stafford

Subject: Please help with this equation, FDTD or simple integration problem

From: salman

Date: 27 Jun, 2011 01:47:04

Message: 5 of 5

"Roger Stafford" wrote in message <iu8ks9$d3$1@newscl01ah.mathworks.com>...
> "salman " <salmanabdullah9@gmail.com> wrote in message <iu8ifc$o8p$1@newscl01ah.mathworks.com>...
> > ....... the method that i have in mind is this;
> > the quantity A(z,t) in the equation is an output from a previous program. so i aim to solve this with FTCS or Lax etc, method, by which i just discretize the problem in z and do it for each value of t, though i have at most 20 t values. is it fine?
> > Would you suggest doing it by FDTD or not?
> - - - - - - - - - - - -
> You have me greatly puzzled, Salman. Where you spoke of an ode solver which "should give me the result of A as function of space and time", I interpreted that as meaning that A(z,t) is the unknown in your problem, but now you say that "the quantity A(z,t) in the equation is an output from a previous program" which would indicate quite otherwise. If you had said that your B(z) or C(z) is an output, that would make more sense.
>
> If B(z) and C(z) can readily be defined in terms of a matlab function, there is no reason I can see for not using one of matlab's ode solvers. On the other hand, if B(z) and/or C(z) can only be defined for some predetermined set of discrete values, then that would probably call for some finite difference method of approximating the solution. Of course, the fineness of such discrete data may well determine the accuracy of your result.
>
> You should remember that having discrete data does not prevent you from using higher order difference schemes such as the Runge Kutta method if your discrete data is accurate.
>
> As for A(z,t) itself, please relieve my anxiety and tell me whether it is an unknown, or if it is not, what it is you are trying to solve for.
>
> Roger Stafford

Dear Roger,

Thanks for helping me,

Rogerm as we have an ODE in time, like dy/dt=c*y+..., similarly i have dA(z,t)/dz=-(a/2)*cos(B(z))*A(z,t)+a*sin(B(z))*F*(2t2-t1-t); (only difference is that here i have derivative in space) t1 and t2 are the time instants where a previous 2 pulses are centered, giving rise to the third pulse, thats is A(z,t), which i want to get the profile for, as a function of space and time. Roger, if you would be so kind please have alook at the equation .40 in this article, thats all i need to profile, thats all i need;

http://www.opticsinfobase.org/abstract.cfm?id=71171

i will wait for your kind help.

thanks

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us