
1. Re: How to get derivative and signum function in PSoC 5
user_264321 May 9, 2013 8:19 PM (in response to userc_41382)if you have the values of the function in an array it is just a matter of doing simple X1X0*mod and storing it in another array

2. Re: How to get derivative and signum function in PSoC 5
user_264321 May 9, 2013 8:23 PM (in response to userc_41382)imean (X1X2)*mod
where mod properly scales the value

3. Re: How to get derivative and signum function in PSoC 5
JoMe_264151 May 10, 2013 5:03 AM (in response to userc_41382)Signum is defined as 0 if x==0; 1 if x >0 and 1 if x<0. Nothing we can tell more without a bit more insight into what runs and what not.
To calculate the derivate of a given function you have the choice to calculate it as a math solution and implement the function in C as usual or calculate an approximation based on the hints of the previous post calculating dY/dX as discrete (Y1Y0)/(X1X0) and keeping an eye on (X1X0) getting near zero.
It sounds a bit like programming a controlloop (PID) . there are examples in the web for C subroutines.
Bob

4. Re: How to get derivative and signum function in PSoC 5
user_264321 May 10, 2013 9:24 AM (in response to userc_41382)for the Signu, depending on the data type you could just check the sign bit.

5. Re: How to get derivative and signum function in PSoC 5
JoMe_264151 May 10, 2013 11:12 AM (in response to userc_41382)@Zeta
That's not enough, remember the Zero which should return 0
Bob

6. Re: How to get derivative and signum function in PSoC 5
user_264321 May 10, 2013 5:05 PM (in response to userc_41382)my ad, but you just need to add a comparison for the special case of zero

7. Re: How to get derivative and signum function in PSoC 5
user_264321 May 10, 2013 5:05 PM (in response to userc_41382)my bad*

8. Re: How to get derivative and signum function in PSoC 5
JoMe_264151 May 11, 2013 8:09 AM (in response to userc_41382)Not too bad (Smile)
Bob