help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help for inversing function.


From: Ozzy Lash
Subject: Re: Help for inversing function.
Date: Wed, 18 Jan 2012 09:55:20 -0600

On Tue, Jan 17, 2012 at 11:14 AM, kleysonr <address@hidden> wrote:
> Thank you for the anwser,
>
> I have already tried that, but it works only for diff(data, 1) and I need
> also include the first element in the begin of the vector:
>
> data = [73; 83; 135; 200; 288; 300; 267; 251; 302; 381]
>
>> [data cumsum([73;diff(data,1)])]
> ans =
>
>    73    73
>    83    83
>   135   135
>   200   200
>   288   288
>   300   300
>   267   267
>   251   251
>   302   302
>   381   381
>
> But for diff(data, 2), doesn't work.
>
>> [orig cumsum([73;83;diff(orig,2)],2)]
> ans =
>
>    73    73
>    83    83
>   135    42
>   200    13
>   288    23
>   300   -76
>   267   -45
>   251    17
>   302    67
>   381    28
>
> Regards.
> Kleyson Rios.
>
> --
> View this message in context: 
> http://octave.1599824.n4.nabble.com/Help-for-inversing-function-tp4303834p4303960.html
> Sent from the Octave - General mailing list archive at Nabble.com.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave

I think you can get the data back if you know the first original
element and the first difference  (or the first 2 elements)  If your
data is as above,

cumsum([73;cumsum([10;diff(data,2)])]

gets back your data.  73 is the first element of the data, and 10 is
the difference between the second and first elements.

Hope that helps,

Bill


reply via email to

[Prev in Thread] Current Thread [Next in Thread]