Prev: [Simulink] Sample time - sequence stair
Next: Saving a figure (using script) in a specific directory
From: alex lunax on 4 Jun 2010 17:50 How to write step function like 0 for every discrete k <0 1 for k>=0 I need this for isolate only the causal part of a signal like f=2^(k)
From: us on 4 Jun 2010 18:34 "alex lunax" <ludaoc(a)hotmail.com> wrote in message <hubser$ib2$1(a)fred.mathworks.com>... > How to write step function like > 0 for every discrete k <0 > 1 for k>=0 > > I need this for isolate only the causal part of a signal like > f=2^(k) one of the very many solutions - you figure out the length of each sequence for your particular case... nl=10; s=[zeros(1,nl),ones(1,nl)]; us
From: Walter Roberson on 4 Jun 2010 18:37 alex lunax wrote: > How to write step function like > 0 for every discrete k <0 1 for k>=0 > > I need this for isolate only the causal part of a signal like > f=2^(k) Would this perchance be a simulink question? A symbolic question? If it is a pure numeric question, and you do not mean anything special by "discrete k" (that is, that the value is not to be any different if k is non-integral) then stepfun = @(k) (k >= 0);
From: alex lunax on 4 Jun 2010 19:09 ok i will post exactly the question: my function in discrete time is: f=a^(k-1) only k>=0 and i need the Z transformation of this function but if i type ztrans(f) the solution is wrong of couse in this way i get also the contribution in k=0 of a^k which is wrong cause all my signals is defined in k>=0 so a^k in k=0 is 0. But matlab offcourse decide that a^(k-1) for k=0 it's 1/2. This is true if a^k it's definied for all k but not in my case. So what i need is multiply the f for stepfunction in (k-1) , in this way i but the value of a^k in 0. The the ztrans will be right. Thx for your time.
From: Walter Roberson on 4 Jun 2010 23:27
alex lunax wrote: > my function in discrete time is: f=a^(k-1) only k>=0 and i need the Z > transformation of this function > but if i type ztrans(f) the solution is wrong of couse in this way i get > also the contribution in k=0 of a^k which is wrong cause all my signals > is defined in k>=0 so a^k in k=0 is 0. But matlab offcourse decide that > a^(k-1) for k=0 it's 1/2. This is true if > a^k it's definied for all k but not in my case. So what i need is > multiply the f for stepfunction in (k-1) , in this way i but the value > of a^k in 0. The the ztrans will be right. a^(k-1) for k=0 is a^(-1), and that is well-defined value with k in the range you have asserted that k is valid (k >= 0 implies that k can equal 0), so I do not see why you say it should be 0. You also have to watch out for k=1, as that would be a^0, which is defined as 1 if a is not 0, but is indeterminate if a is 0, with 0^0 meaning 0 as one of the alternatives (since limit 0^x is 0 as x approaches 0); however, if a is fixed and non-zero and it is k that is varying, then it would be improper to consider a^0 to be 0 based upon limits along a, so a^k should _not_ become 0 for you when k is 0. Hence, with the information and arguments you have provided, it appears to me incorrect for you to say that a^(k-1) should be 0 at k=0 or even at k=1. The discussion would vary a little if it were a^k being considered and k was defined to be valid only for k > 0 and not when k = 0: in such a case, as k approached 0, the limit would be clearly 1 with no wiggle-room for 0^0. |