Pages: [1]   Go Down
Author Topic: math function  (Read 945 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I am going to to build a symtem with plenty of fomular, anyone know what code to perform integration function and transfer function?


Thanks and regards.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 505
Posts: 31343
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Transfer function is best done with a look up table.
Integration is best done by using discreet methods.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If the system is a real time system, how would the coding be?
It's function is to integrate acceleration to velocity then position.
And integration in PID function.

Thanks for the help.


Regards
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 505
Posts: 31343
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
to integrate acceleration to velocity then position.
If this is data from an acceleration sensor then the results are less than perfect because of noise on the output of the sensor. This gives a DC term into the integrator which causes the output to drift consistently, giving an error in any positional reading. I assume you want to do an inertial navigation system or a dead reckoning system. The results of trying to do this are not very good.

You have to write the code to implement what ever algorithm you are using, look here for the algorithms you can use:-
http://en.wikipedia.org/wiki/Integral#Computing_integrals

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Mine is to build a 'virtual' position signal (with the affect of force detected) and compare with the the actual position calculated and correct the actual position to be same as the virtual one (the force will vary all the time).

Thanks for the help~=)

Regards.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 168
Posts: 12425
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Quote
the force will vary all the time

Is this a quote from Star Wars ? smiley-wink

seen this - http://arduino.cc/playground/Code/PIDLibrary - ?

Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have read that link before, but now the quetions is I have two different input and require two different Kp, will this working as well? If so how to modify the code?
I am doing job like converting simulink(done by others) to arduino code.

attached image is how does my PID look like.


p/s: I duno how to insert image, not sure can bee seen or not?



Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thx for the help
I misunderstanding the simulink..
Now I trying with the PID() function



Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there any sample code for doing integration and transfer function?


Thanks for the help~~~
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 168
Posts: 12425
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Theory
- http://en.wikipedia.org/wiki/Trapezoidal_rule -
- http://en.wikipedia.org/wiki/Numerical_analysis -

Some practice:
- http://www.cplusplus.com/forum/general/26335/ -
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Pages: [1]   Go Up
Jump to: