- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I want use the Psoc5 in a new design. In this design I want use complex number. Is it possible in psoc creator 2.1?
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, any processor can handle a complex number, but you might
have to keep track of the real and imaginary components, depending
on what you are doing. Also the available GNU library has transcendental
functions if you want to work in complex polar. But again, you have to do the
simple math coding. Example., you want RMS of complex power, that is
very straighforward knowing the Re and Im parts of the number.
In fact you could easily write macros to implement your own specific
library of complex number calculations.
Regards. Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, any processor can handle a complex number, but you might
have to keep track of the real and imaginary components, depending
on what you are doing. Also the available GNU library has transcendental
functions if you want to work in complex polar. But again, you have to do the
simple math coding. Example., you want RMS of complex power, that is
very straighforward knowing the Re and Im parts of the number.
In fact you could easily write macros to implement your own specific
library of complex number calculations.
Regards. Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Some links that might be of interest -
http://www.gnu.org/software/libc/manual/html_node/Complex-Numbers.html
http://www.gnu.org/software/libc/manual/html_node/Operations-on-Complex.html
http://www.gnu.org/software/gsl/manual/html_node/Complex-Numbers.html
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank danaaknight for your answer
I know that I can make my library for complex (it not complex !!!).
But I want use the C99 library.
For the compiler I add the command line "-std=gnu99"
When I write
#include "complex.h"
the gcc compiler from PSoC Creator 2.1 give an error :
.\main.c:14: fatal error: complex.h: No such file or directory
the other include are Ok .
....
25 : _Complex float a=1.3+2.5i;
26 : sprintf(strtmp, "a = %g + %gi\n", creal(a), cimag(a));
...
This small program is working but with warning because compiler dont know "complex.h" and the linker is Ok
.\main.c:26: warning: implicit declaration of function 'creal'
.\main.c:26: warning: incompatible implicit declaration of built-in function 'creal'
.\main.c:26: warning: implicit declaration of function 'cimag'
.\main.c:26: warning: incompatible implicit declaration of built-in function 'cimag'
My question is why it dont find complex.h . I see it in the folder :
C:\Program Files\Cypress\PSoC Creator\2.1\PSoC Creator\import\gnu_cs\arm\4.4.1\arm-none-eabi\include\c++\4.4.1
( May be it's working only with a Cpp file not in C file?)
Thank for your answers and may be a working example in PSoC creator.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think that I can't use <complex.h> in C program but only in Cpp program, but PSoC creator don't support Cpp program.
Can you confirm or have you a simple example with <complex.h> use ?
Thank for you very good job for the support.
Best regards
Jack.