Mathc complexes/a283
Installer et compiler ce fichier dans votre répertoire de travail.
c0b.c |
---|
/* ------------------------------------ */
/* Save as : c0b.c */
/* ------------------------------------ */
#define CR 5.
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#include "f.h"
#include "dft.h"
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
double **DFT = dft( i_mZ(CR,CR), CR);
double **F = r_mRZ(i_mZ(CR,C1),9);
double **Ft = i_mZ(CR,C1);
clrscrn();
printf(" DFT : \n");
p_mZ(DFT, S8,P3, S8,P3, C4);
stop();
clrscrn();
printf(" F : \n");
p_mZ(F,S8,P3,S8,P3,C4);
printf(" Ft = DFT * F \n");
mul_mZ(DFT,F,Ft);
p_mZ(Ft,S8,P3,S8,P3,C4);
stop();
clrscrn();
printf(" Bessel's formula: \n\n");
printf(" ||F ||**2 = %.3f \n", pow(norm_Z(F ),2));
printf(" 1/%.0f ||Ft||**2 = %.3f \n\n", CR, 1/CR* pow(norm_Z(Ft),2));
stop();
f_mZ(DFT);
f_mZ(F);
f_mZ(Ft);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
DFT :
+1.000 +0.000i +1.000 +0.000i +1.000 +0.000i +1.000 +0.000i
+1.000 +0.000i +0.309 -0.951i -0.809 -0.588i -0.809 +0.588i
+1.000 +0.000i -0.809 -0.588i +0.309 +0.951i +0.309 -0.951i
+1.000 +0.000i -0.809 +0.588i +0.309 -0.951i +0.309 +0.951i
+1.000 +0.000i +0.309 +0.951i -0.809 +0.588i -0.809 -0.588i
+1.000 +0.000i
+0.309 +0.951i
-0.809 +0.588i
-0.809 -0.588i
+0.309 -0.951i
Press return to continue.
Exemple de sortie écran :
F :
+3.000 +0.000i
+3.000 +0.000i
-9.000 +0.000i
+5.000 +0.000i
+7.000 +0.000i
Ft = DFT * F
+9.000 +0.000i
+9.326 +12.033i
-6.326 -10.964i
-6.326 +10.964i
+9.326 -12.033i
Press return to continue.
Exemple de sortie écran :
Bessel's formula:
||F ||**2 = 173.000
1/5 ||Ft||**2 = 173.001
Press return to continue.