01-21-2020 08:42 AM
Hello all,
I'm trying to figure out the level of support of C99 complex numbers in CVI 2019. So far:
Solved! Go to Solution.
10-03-2022 03:08 AM
The solution that works on my computer;
double complex R1;
double complex R2;
double complex R3;
double complex R4;
double complex C1;
double complex C2;
double complex C3;
double complex L1;
double complex L2;
R1=5.0 + 7.0*I;
R2= 34.0 – 34.0*I;
R3=45*I;
R4=34.0;
C1=1/(I*2*PI*nFrequency*1000000.0*nPANEL_C1/1000000.0);
C2=1/(I*2*PI*nFrequency*1000000.0*nPANEL_C2/1000000.0); C3=1/(I*2*PI*nFrequency*1000000.0*nPANEL_C3/1000000.0); L1=(I*2*PI*nFrequency*1000000.0*nPANEL_L1/1000000.0);sprintf(sPANEL_L1,"%f",nPANEL_L1); L2=(I*2*PI*nFrequency*1000000.0*nPANEL_L2/1000000.0);sprintf(sPANEL_L2,"%f",nPANEL_L2);
double complex a=R2+C2;
double complex b=(a * nPANEL_MAINS)/(a + nPANEL_MAINS);
double complex c= b + L2;
double complex d=C1+R1;
double complex e= c*d/(c+d);
double complex f= e+L1;
double complex g= C3+((R3*R4)/(R3+R4));
double complex h= (f*g)/(f+g);
double Magnitute=pow((pow(creal(h),2)+pow(cimag(h),2)),0.5);
double Phase= atan(cimag(h)/creal(h))*180/PI;
10-13-2022 08:59 AM
Soydan,
Your example works and can even be debugged easily, but the c*() functions, such as ccos() are nowhere to be found. Is there a complex.lib that needs to be linked with the prog for that ?