06-28-2012 07:10 AM
HI,
I'm using the AmpPhaseSpectrum function and i don't know how it works exactly. For instance, i don't understand what i have to pass in the 'df' parametre (expected to be a double in the recall function panel but a pointer to double in function help), is this an output? I'm not really sure... :s
Moreover, when i run the code, at the line of this function, the code stops and it is said : The program has caused a 'Genereal protection' fault at... What does it mean?
Supplementary question with no link with above :
I want to compute the module of a complex number. I use two local variables : a and b. Respectively the real and imaginary part. Then I compute : sqrt(a*a+b*b). The error seems to be that a*a+b*b is not a positive number (error==33(0x21) EDOM domain error). Did i miss something?
Thanks,
_trent_
06-29-2012 07:35 AM
Hi,
In the df parameter you have to pass a double by its reference, this way you will change the value of df in the AmpPhaseSpectrum function, it's like an output yes.
May be you have the error 'General protection' because you didn't check the number of elements in the arrays you pass in parameters "Amplitude Spectrum" and "Phase Spectrum" that should be numberOfElements/2 at least as described in the help of each parameter.
c = sqrt(a*a+b*b); is correct, what are the values of a & b ?
Regards
Jean-Luc D. NI France
National Instruments France
06-29-2012 08:00 AM - edited 06-29-2012 08:00 AM
Ok, I fixed my issue with df.
About the sqrt: I used ReFFT (or FFtTex whatever) to compute the FFT of a signal. I get the reel part in a[i] and the imaginary part in b[i]. But i don't exactly know what there is in those variables.
And thank you for your answers