From: Riccardo on 7 Apr 2010 12:23 "Steven Lord" <slord(a)mathworks.com> wrote in message <hpi4ec$e9a$1(a)fred.mathworks.com>... > > "kumar vishwajeet" <kwzeet(a)gmail.com> wrote in message > news:hpgqjn$gv4$1(a)fred.mathworks.com... > > "kumar vishwajeet" <kwzeet(a)gmail.com> wrote in message > > <hpgovk$pd4$1(a)fred.mathworks.com>... > >> TideMan <mulgor(a)gmail.com> wrote in message > >> <b94018b6-814f-473c-8316-990881bdac94(a)w17g2000yqj.googlegroups.com>... > >> > On Apr 7, 1:08 pm, "kumar vishwajeet" <kwz...(a)gmail.com> wrote: > >> > > TideMan <mul...(a)gmail.com> wrote in message > >> > > <b787b93d-3173-4ca1-9a48-d75f6afa6...(a)r1g2000yqb.googlegroups.com>... > >> > > > On Apr 7, 12:36 pm, "kumar vishwajeet" <kwz...(a)gmail.com> wrote: > >> > > > > Does anyone know about differential operator in MATLAB > >> > > > > corresponding to "D" operator in Mathematica. I am not looking > >> > > > > for diff() function. I just want to use d/dt corresponding to > >> > > > > "d/dx" used in mathematica. I want to use this "d/dt" operator in > >> > > > > Bessel function: > >> > > > > 1+sigma*D/alpha^2 > >> > > > > where D is the differential opeartor "d/dt" > >> > > > >> > > > I know nothing about Mathematica, but to numerically differentiate > >> > > > in > >> > > > Matlab, use: > >> > > > help diff > >> > > > help gradient > >> > > > >> > > > BTW, your equation makes no sense to me. > >> > > > By my way of reckoning, D must have an argument of some sort. > >> > > > >> > > A bessel function ratio is defined as following: > >> > > B = 1 > >> > > for ctr = 1:inf %here inf can be replaced with any finite number for > >> > > approximation > >> > > num = 1+sigma*D/(alpha1(ctr)*alpha1(ctr)) > >> > > den = 1+sigma*D/(alpha0(ctr)*alpha0(ctr)) > >> > > B = B*num/den > >> > > end > >> > > > >> > > alpha0 and alpha1 are zeros of zero - order and first order bessel > >> > > function. > >> > > The final value of B is the bessel function ratio that I am trying to > >> > > calculate. > >> > > >> > So when you write: > >> > D/(alpha1(ctr)*alpha1(ctr)) > >> > you don't mean the quotient of D and (alpha1(ctr)*alpha1(ctr)), > >> > you mean the derivative of (alpha1(ctr)*alpha1(ctr)) with respect to > >> > t. > >> > Is that correct? > >> > If so, that's pretty weird notation. > >> > > >> > And are you trying to differentiate (alpha1(ctr)*alpha1(ctr)) > >> > numerically or symbolically? > >> > >> No I am not trying to divide or differentiate (alpha1(ctr)*alpha1(ctr)). > >> The following expansion will make it clear:- > >> 1+a1*d/dx+a2*(d/dx)^2+a3*(d/dx)^3+a4*(d/dx)^4+...........till infinity > >> can be written as: > >> 1+a1*D+a2*D+a3*D+................ till infinity > >> where ai = sigma/(alpha1(ctr)*alpha1(ctr)) > >> So I am trying to find a replacement for D in MATLAB. > > > > Sorry..I mean > > 1+a1*D+a2*D^2+a3*D^3+................ till infinity > > You can't have just a "naked" derivative operator -- you have to apply it to > some function. If you have a symbolic function created using Symbolic Math > Toolbox, then DIFF is the correct function to use ... as long as you use it > on a sym object, which will invoke the DIFF _method_ for sym objects rather > than the numeric DIFF _function_ which computes a difference. > > syms t > f = sin(t)+cos(t); > derivative = f; % the "0th" derivative is F itself > n = 20; > a = 1:n; > total = sym(ones(1, n+1)); > for k = 1:n > derivative = diff(derivative, t); > total(k+1) = a(k)*derivative; > end > sumOfDerivatives = sum(total) > > Note I've done it this way so you can see each term that contributes to the > sum -- if you want you can simply add each term to the running total inside > the loop. > > Note that if you want you could put this code in a function that accepts f > and the symbolic variable with which to differentiate; that way you could > apply it like the "naked" (1+sum(a(k)*D^k)) operator you described above. > > -- > Steve Lord > slord(a)mathworks.com > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ > Perhaps the OP question can be rephrased as "can I do Operational Calculus in Matlab?". I'd say the Symbolic Math Toolbox should be a decent candidate for that.
First
|
Prev
|
Pages: 1 2 3 Prev: HDMI Image Acquisition Next: Separating GUI Concerns / Nesting Functions |