Zum Inhalt springen

Heinrich der IT-genie 78

Mitglieder
  • Gesamte Inhalte

    12
  • Benutzer seit

  • Letzter Besuch

Alle Inhalte von Heinrich der IT-genie 78

  1. wer kann mir bitte die besten Virusschutz programme sagen! und deren zieladresse geben????? Danke im Voraus!
  2. Subnetzmaske wie berechnet man den subnetmaske?
  3. Ich habe ebenso versucht ein programm für die berechnung der fourier transformation, bloß kein erfolg. ich muss dass bis montag fertigen. Hilft mir bitte #include <studio.h> #include <math.h> :::: double fct( int chf, double x) // Funktionen zur Auswahl { x=(-1.0)+x/M_PI; // symmetrisiert [-1,1] auf [0, 2 pi] if (chf==0) { if (x>=0.1) return(sqrt(x)); else return(sqrt(-x)); } if (chf==1) // sollte exakt reproduziert werden, { // wenn n>=4 return(cos(4.0*M_PI*(x+1.0))); } if (chf==2) // Gaussglocke { return(exp(-10.0*x*x)); } if (chf==3) // Runge { return(2.0/(1.0+15.0*x*x)); } if (chf==4) // Betrag { return(fabs(x)); } if (chf==5) // Sprung { if (x>=0.0) return(1.0); else return(-1.0); } return 0.0; } int bitinverse(int k, int n) // bildet Bitinversion von k < n=2 hoch p { // unter Vermeidung von Shiftoperatoren. int c=0; // Das kann effizienter gemacht werden! if (n<=1) // Effizientere Versionen sind leider return(0); // noch schwerer verstaendlich.... // c sammelt das Ergebnis auf, // n laeuft absteigend durch die Zweierpotenzen while(n>1) // Logarithmische Ausfuehrungszeit! { n/=2; // fuer hoechstes Bit if (k%2) // hole unteres Bit von k c+=n ; // baue es vorn in c ein k/=2; // reduziere k am unteren Ende } return©; } void split(int n, int inv, // Nichtrekursive Verteilungsroputine. Vector real, Vector imag) // inv = 1/-1: FFT/inverse FFT. { // Die Vektoren werden ueberschrieben! if (RSNMoutput) { cout<<"Aufruf split fuer n = "<<n<<"\n"; for (int i=0; i<n; i++) cout.form("%3d : %8.4f + i * %8.4f \n" ,i,real,imag); } int m, mstart, mend, mpj; double c, s, rj, ij, c1, s1, ch, signum=(double)inv; // Ab hier: Verteilungsschritte: for (m=n/2; m>=1; m/=2) // es gibt log(n) Schritte... { // Ab hier kommt die nichtrekursive Form // des naiven Programms. // Es werden Teilarrays der Laenge 2*m bearbeitet, // und zwar in zwei Segmente der Laenge m aufgeteilt, // wobei die ueblichen FFT-Formeln angewendet werden: // rho = 0 und 1, siehe Buch, Formel (12.2.27). // Dabei laeuft man ueber die arrays weg (Datenlokalitaet!) // und arbeitet auf Indizes in [mstart,mstart+2m). for (mstart=0; mstart<n-m; mstart+=2*m) // Laufschleife... { mend=mstart+m; // die Schleife unten laeuft nur ueber m Elemente, if (RSNMoutput) // bearbeitet aber 2*m Elemente! { cout<<"Aufruf split fuer m = "<<m<< " zwischen "<<mstart<< " und "<<mend+m-1<<"\n"; for (int i=mstart; i<mend+m; i++) cout.form("%3d : %8.4f + i * %8.4f \n", i,real,imag); } // Die Drehfaktoren werden hier durch trigonometrische // Formeln iterativ berechnet, umd sin/cos-Aufrufe zu sparen. // Ob das effizienter ist, ist fraglich, weil das Timing // eines sin/cos-Aufrufes durchaus mit dem einer Multiplikation // vergleichbar sein kann (bei intelligenten Coprozessoren). c1=cos(signum*M_PI/((double)m)); // Das ist \zeta_{2m}^{signum}, s1=sin(signum*M_PI/((double)m)); // Real- und Imag.teil // NUR OBEN: Unterschied FFT-inverse FFT im Verteilungsschritt c=1.0; // Das ist \zeta_{2m}^{0}, s=0.0; // Real- und Imag.teil for (int j=mstart; j<mend; j++) // Arbeitsschleife // Das sollte schon bekannt sein { // aus der naiven Routine. rj=real[j];// Die Schleife laeuft ueber m Werte, ij=imag[j];// veraendert aber 2*m Werte im array mpj=m+j; real[j]+=real[mpj];// (12.2.27), rho = 0 imag[j]+=imag[mpj]; real[mpj]=rj-real[mpj]; // Beginn von (12.2.27), rho = 1 imag[mpj]=ij-imag[mpj]; rj =real[mpj]*c-imag[mpj]*s; imag[mpj]=real[mpj]*s+imag[mpj]*c; real[mpj]=rj; ch=c1*c-s1*s; // Additionstheoreme fuer sin/cos s= c1*s+s1*c; c=ch; } if (RSNMoutput) { cout<<"Nach Aufruf split fuer m = "<<m<< " zwischen "<<mstart<<" und "<<mend+m-1<<"\n"; for (int i=mstart; i<mend+m; i++) cout.form("%3d : %8.4f + i * %8.4f \n", i,real,imag); } } } if (RSNMoutput) { cout<<"Ende split fuer n = "<<n<<"\n"; for (int i=0; i<n; i++) cout.form("%3d : %8.4f + i * %8.4f \n", i,real,imag); } } void fft(int n, int inv, // FFT ueber Verteilung und Bitinversion. Vector real, Vector imag) // inv =1/-1 : FFT/inverse FFT { if (RSNMoutput) { cout<<"Aufruf fft fuer n = "<<n<< " und inv = "<<inv<<"\n"; for (int i=0; i<n; i++) cout.form("%3d : %8.4f + i * %8.4f \n" ,i,real,imag); } split(n, inv, real, imag); // das macht die Verteilungsschritte int bitinv; // Der Rest ist Umsortieren der Ergebnisse. double help; // Dazu wird die Bitinversion benutzt. for (int i=0; i<n; i++) // Das ist fuer FFT und inverse FFT gleich. { bitinv=bitinverse(i,n);// Kann man auch inline setzen.... if (bitinv>i) // Vermeidet Doppelvertauschung.... { help=real; // Vertauschen.... real=real[bitinv]; real[bitinv]=help; help=imag; imag=imag[bitinv]; imag[bitinv]=help; } } if (inv==(-1)) // Sonderfall inverse FFT { for (int i=0; i<n; i++) { real/=n; imag/=n; } } if (RSNMoutput) { cout<<"Ende Aufruf fft fuer n = "<<n<<"\n"; for (int i=0; i<n; i++) cout.form("%3d : %8.4f + i * %8.4f \n", i,real,imag); } } double fftreal (int n, double t, // wertet die FFT auf primitive Weise aus // an der Stelle z=exp(i*t), nur Realteil. Vector realout, Vector imagout) // FFT output { // Setzt voraus, dass eine trigonometrische // Interpolation der Laenge n vorliegt double dreal, dimag; double c, s; dreal=0.0; dimag=0.0; for (int k=0; k<n; k++) { c=cos(t*((double) k)); // Auch das kann man durch Drehen machen, // wenn man sin/cos-Aufrufe sparen will s=sin(t*((double) k)); dreal+=c*realout[k]-s*imagout[k]; dimag+=s*realout[k]+c*imagout[k]; } c=cos(t*0.5*((double)n)); // Achtung: es ist an Interpolation gedacht s=sin(-t*0.5*((double)n)); return(dreal*c-dimag*s); } int main() { int nmax, chf; double t, tstep, tnext, s, c; ofstream pointfile, intfile; RSNMoutput=1; pointfile.open("points"); intfile.open("interpol"); do { cout<<"Bitte 0/1/2/3/4/5 eingeben" <<" fuer diverse Funktionen\n"; cin>>chf; } while (chf*(6-chf)<0); cout<<"Bitte Punktzahl (Zweierpotenz) eingeben\n"; cin>>nmax; Vector realin =NewVector(nmax); Vector imagin =NewVector(nmax); for (int i=0; i<nmax; i++) { t=((double)i)*2.0*M_PI/((double) nmax); c=cos(t*0.5*((double)nmax)); // Drehfaktoren fuer Interpolation... s=sin(t*0.5*((double)nmax)); // siehe (12.2.9) realin=fct(chf,t); pointfile<<t<<' '<<realin<<'\n'; realin*=c; // Drehung vereinfacht wg. Imaginaerteil=0 imagin=s*realin; } fft (nmax, -1, realin, imagin); /* fft (nmax, 1, realin, imagin); */ // zum Testen // Plotterei tstep=(0.02*M_PI/((double) nmax)); t=0.0; for (int i=0; i<nmax; i++) { tnext=((double)i+1)*2.0*M_PI/((double) nmax); while (t <tnext) { intfile<<t<<' '<< fftreal(nmax, t, realin, imagin)<<'\n'; t+=tstep; } t=tnext; } DeleteVector(imagin); DeleteVector(realin); pointfile.close(); intfile.close(); }
  4. EILT SEHR!!! Hallo Gemeinde, kann jemand mir sagen ob diese quellcode funktioniert oder nicht! Wenn nicht können sie mir bitte dann helfen!?!?! :: #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <limits.h> int main(int argc,char **argv){ int i, n; int sample; n = 1024; sample = 256; for (i=0; i<n; i++) { printf("%lf \n",sin(2*M_PI*i/sample)+0.5*cos(6*M_PI*i/sample)); } return 0; } -------------------------------------------------------------------------------- Fast Fourier Transform © -------------------------------------------------------------------------------- This little C-programme FOURIER-transforms the discrete (real) function given by n (which should be an integer power of 2!) data points on standard input to n records containing the real and imaginary part of the transform on standard output. The variables in FFT designate: m: 2m: number of data points; A: a (complex) vector of length at least 2m; INV: INV=1 backward, otherwise forward FFT; -------------------------------------------------------------------------------- /***** fft *****/ #include <stdio.h> #include <stdlib.h> #include <math.h> #define MX 13 #define NX 8192 typedef struct { double real, imag; } complex; void FFT ( complex A[], int m, int INV ) { /* This is a c-adaption by */ /* Bernard Metsch */ /* from the FORTRAN programme FFT */ /* from Paul. L. DeVries, Computerphysik, */ /* Spektrum Akademischer Verlag, */ /* Heidelberg 1994, */ /* which is in turn an adaption from */ /* a FORTRAN Code of the Cooley & Tukey method by: */ /* Cooley, Lewis and Welch, IEEE Transactions E-12 */ /* 1965 */ /* The array A contains the complex data to be transformed, */ /* `m' is log2(N), and INV is an index = 1 if the inverse */ /* transform is to be computed (The forward transform is */ /* evaluated if INV is not = 1). */ complex u, w, t; double ang; int N, Nd2, i, j, k, l, le, le1, ip; /* /* This routine computes the Fast Fourier Transform of the */ /* input data and returns it in the same array. Note that */ /* the k's and x's are related in the following way: */ /* */ /* IF K = range of k's and X = range of x's */ /* */ /* THEN delta-k = 2 pi / X and delta-x = 2 pi / K */ /* */ /* When the transform is evaluated, it is assumed that the */ /* input data is periodic. The output is therefore periodic */ /* (you have no choice in this). Thus, the transform is */ /* periodic in k-space, with the first N/2 points being */ /* 'most significant'. The second N/2 points are the same */ /* as the Fourier transform at negative k!!! That is, */ /* */ /* FFT(N+1-i) = FFT(-i) ,i = 1,2,....,N/2 */ /* */ N = pow(2,m); Nd2 = N/2; j = 1; for (i=1; i<N; i++) { if (i<j) { t = A[j-1]; A[j-1] = A[i-1]; A[i-1] = t; } k = Nd2; while (k<j) { j -= k; k /= 2; } j += k; } le = 1; for (l=1; l<=m; l++) { le1 = le; le += le; u.real = 1.0; u.imag = 0.0; ang = M_PI / le1; w.real = cos(ang); w.imag = -sin(ang); if (INV==1) w.imag = -w.imag; for (j=1; j<=le1; j++) { for (i=j; i<=N; i+=le) { ip = i + le1; t.real = A[ip-1].real * u.real - A[ip-1].imag * u.imag; t.imag = A[ip-1].real * u.imag + A[ip-1].imag * u.real; A[ip-1].real = A[i-1].real - t.real; A[ip-1].imag = A[i-1].imag - t.imag; A[i -1].real = A[i-1].real + t.real; A[i -1].imag = A[i-1].imag + t.imag; } t.real = u.real * w.real - u.imag * w.imag; t.imag = u.real * w.imag + u.imag * w.real; u = t; } } if (INV!=1) for (i=0; i<N; i++) { A.real /= N; A.imag /= N; } } /* end FFT */ int main(int argc,char **argv){ int i, j, k; int n, m, n2; complex F[NX]; double a; n = 0; while ( scanf("%lg",&a)!=EOF ) { F[n].real = a; F[n].imag = 0.0; n++; if (n==NX) { printf("too many data points!\n"); return 0 ; } } printf("# number of data points read: %d\n",n); // determine m: j = 1; m = -1; for (i=0; i<=MX; i++) { if (j==n) { m = i; } j *=2; } if (m==-1) { printf("# number of data points not a power of 2 !!!\n"); return 0; } else { printf("# log_2(%d) = %d\n", n, m); } FFT ( F, m, 0 ); n2 = n / 2; for (i=0; i<n; i++) { printf("%lg %lg\n",F.real,F.imag); } return 0; } /* main */
  5. Hallo leute ich muss ein Facharbeit in MAthe machen, über Fourierreihe ich muss irgendwie einen Programm in c++ darüber schreiben. ich weis leider nicht, wie dies geht. Könnt ihr mir bitte dabei helfen??? :
  6. was haltet ihr von der Raumfahrttechnikstudium???
  7. Hallo Gemeinde, ich habe folgendes Problem; ich will ein komplettes Studium im Ausland absolvieren. (Madizin) kann mir jemand darüber informationnen geben??
  8. Hei, erst mal du kannst an einer Fachhochschule studieren! ob du Fachabi im bezug auf wirtschaft hast ist eigentlich egal, aber es bietet jede Menge Informatikstudien mit Bezug auf Wirtschaft: wie beispielsweise Wirtschaftsinformatiker. Hast du die nach der elften klasse eine Ausbildung angefangen????
  9. Danke dir, denn es ist total wichtig(so wichtig wie mein leben!!!)))
  10. Danke dir, denn es ist total wichtig(so wichtig wie mein leben!!!)))
  11. Wie soll ich das Buch´den finden ???
  12. Holla "FREUNDE" ich habe folgendes problem : ich möchte einen programm in c schreiben, welches ich damit die fourier reihe berechnen kann!!! ich selbst hab probiert. bloß keinen erfolg!! weiß jemand hat jemand zufällig so etwas bereits programmiert und kann sie mir irgenswie schicken.(auch kauf möglich)!

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...