Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

how to do square root or x^2 in the dsp component.

For general discussion related FlowStone

how to do square root or x^2 in the dsp component.

Postby joejoe » Wed Apr 16, 2014 2:22 am

I've been trying to do a exponential calculation in the dsp command.

-It seems we have the exp(x) expression, but this doesn't seem to do what it should. (see attached)

-Normally on a calculator such as the TI-83 we can do 2^2= 4. Doing this in the DSP component the IDE willregisters it as a expression as it turns pink however I cant seem to find the necessary syntax to get a valid expression.

Any help is greatly appreciated.
Attachments
exp test.fsm
(1.23 KiB) Downloaded 866 times
joejoe
 
Posts: 23
Joined: Mon Oct 21, 2013 2:28 am

Re: how to do square root or x^2 in the dsp component.

Postby joejoe » Wed Apr 16, 2014 3:13 am

looks like I figured it out!

y = pow(x,2) where x = base and 2 is the exponent.
joejoe
 
Posts: 23
Joined: Mon Oct 21, 2013 2:28 am

Re: how to do square root or x^2 in the dsp component.

Postby martinvicanek » Wed Apr 16, 2014 8:05 am

To save CPU load, use x*x instead of pow(x,2), Use sqrt(x) instead of pow(x,0.5). There are also optimized modules for powers with arbitrary exponents.
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm


Return to General

Who is online

Users browsing this forum: No registered users and 54 guests