p = 1, 2, cos 2n + p)πj = cos 2nπj 2n + p)πj, sin = sin 2nπj 7.1) f j = a ) 0 + a p + a n+p cos 2nπj p=1 p=0 1 + ) b n+p p=0 sin 2nπj 1 2 a 0 +

Size: px
Start display at page:

Download "p = 1, 2, cos 2n + p)πj = cos 2nπj 2n + p)πj, sin = sin 2nπj 7.1) f j = a ) 0 + a p + a n+p cos 2nπj p=1 p=0 1 + ) b n+p p=0 sin 2nπj 1 2 a 0 +"

Transcription

1 7 7.1 sound_wav_files flu00.wav.wav 44.1 khz 1/44100 spwave Text with Time spwave T > 0 t 44.1 khz t = j t f j {f 0, f 1, f 2,, f 1 = T t 7.2 T {f 0, f 1, f 2,, f 1 T ft) f j = fj t) j = 0, 1, 2,, 1; t = T ) ft) ft) 6.1) ft) = 1 2 a 0 + a n cos 2nπt T + b n sin 2nπt ) T j t j = 0, 1, 2,, 1 f j = fj t) = 1 2 a 0 + a n cos 2nπj t + b n sin 2nπj t ) T T = 1 2 a 0 + a n cos 2nπj 39 + b n sin 2nπj ) 7.1)

2 p = 1, 2, cos 2n + p)πj = cos 2nπj 2n + p)πj, sin = sin 2nπj 7.1) f j = a ) 0 + a p + a n+p cos 2nπj p=1 p=0 1 + ) b n+p p=0 sin 2nπj 1 2 a 0 + a p a 0 a 1+p p=1 p=0 a 1+p a 1 a 1 b 1+p p=0 b 1+p b 1 b 1 p=0 p=0 f j = a a n cos 2nπj + b n sin 2nπj ) j = 0, 1, 2,, 1) 7.2) 7.3 {f 0, f 1, f 2,, f 1 7.2) a 0 a 1 a 2 a 1 b 1 b 2 b 1 θ = 2π/ i i = 1 n 1 r = e inθ S 1) n = 0 S 2) n 0 S 3) j cos njθ cos n)jθ sin njθ + sin n)jθ 4) f 0 f 1 f 2 f 1 n a n = 1 1 f k cos nkθ, b n = 1 1 f k sin nkθ a n a n b n + b n 40

3 {f 0, f 1, f 2,, f 1 a n = 1 b n = f k cos 2πnk f k sin 2πnk n = 0, 1, 2,, 1) n = 1, 2,, 1) 7.3) θ = 2π/ i i = 1 c n = a n ib n cos nkθ i sin nkθ = e inkθ 7.3) c n = 1 1 f k e inkθ n = 0, 1, 2,, 1) 7.4) b 0 = 0 7.2) a = Re a n cos jnθ + b n sin jnθ) = 1 1 a n cos jnθ + b n sin jnθ) c n e ijnθ j = 0, 1, 2,, 1) 1 Re z z c n e ijnθ 7.4) 1 c n e ijnθ = f k e inkθ ) e ijnθ = f k e ij k)nθ ) 1 e ij k)nθ 1 r = e ij k)θ 1) 2) 1 c n e ijnθ = f k e ij k)nθ ) = f j 7.3) {f 0, f 1, f 2,, f 1 = 2M 3) 4) n = 1, 2,, M 1 a n = a n, a n cos 2nπj = a n cos 41 2 n)πj

4 b n = b n, b n sin 2nπj = b n sin 2 n)πj sin 2Mπj f j = 2a 0) 2 + M 1 = sin πj = 0 7.2) 2a n cos 2nπj + 2b n sin 2nπj ) + a M cos 2Mπj 7.5) j = 0, 1, 2,, 1) 7.4 2a n cos 2nπj + 2b n sin 2nπj 2nπj = 2s n cos ψ n ) s n = a n2 + b n 2, cos ψ n = a n s n, sin ψ n = b n s n 7.5) f j = 2a 0) 2 + M 1 2nπj 2s n cos ψ n ) + a M cos 2Mπj 7.6) j = 0, 1, 2,, 1) 2nπj = 2π n T j t) 2s n {f 0, f 1, f 2,, f 1 n T 2a 0 1 T 2 T M 1 T M T a M { 2a 0, 2s 1, 2s 2,, 2s M 1, a M 7.7) Figure 2.1 flute octave 3 Do Figures harp piano octave 3 Do ) 7.3) 44.1 khz

5 = = 2 k k Fast Fourier Transform FFT FFT FFT FFT ASA FFT 7.3) 1 30 FFT 2 3 FFT fft_h_order.c fft4g_h.c fft h order.c fft4g_h.c n = 1, 2,, M 1 1).txt flu04.txt flu04 2) T f 0 f f 0 f 3) FFT 2 < 2 k k 4) 2 k 4) 2 < 2 k f j = f 0 j = + 1, + 2,, 2 k 1) flu04 flu04_ext.txt 5) FFT rdft, 1, f) FFT rdft, 1, f) 1367 FFT rdft, 1, f) f[0] f[1] f[2] f[-1] f 0 f 1 f 2 f 1 rdft, 1, f) f[0] f[1] f[2] f[-1] 7.5) a 0 a 1 a 2 a M b 1 b 2 b 1 f[2n] = a n n = 0, 1, 2,, M 1 f[1] = a M f[2n+1] = b n n = 1, 2,, M 1 43

6 /* fft_h_order.c */ #include <math.h> #include <stdio.h> #include <string.h> #define MAX 32768) #define MAXH 16387) void rdftint, int, double *); //2^12 = 4096, 2^13 = 8192, 2^14 = 16384, 2^15 = 32768, 2^16 = int main) { int, tmp, M, i, j, k, n, flag, order[maxh+1]; double T, f[max+1], es[maxh+1]; FILE *fp; char file_name[100], file_in[100], file_out[100]; double zero = 0.0, tmp; // 1) printf"filename = "); scanf"%s", file_name); strcpyfile_in, file_name); strcatfile_in, ".txt"); fp = fopenfile_in, "r"); // 2) j = 0; flag = 1; while 1) { flag = fscanffp, "%lf %lf", &T, &f[j]); if flag == EOF) break; j = j+1; = j - 1; fclosefp); printf"origial: = %d T = %f\n",, T); f[0] = f[0] + f[])/2.0; f[] = f[0]; // 3) k = log)/log2.0); if pow2, k) < ) k = k + 1; tmp = pow2, k); // 4) 2 if tmp > ) { forj = + 1; j <= tmp; j++) f[j] = f[0]; T = T*tmp)/; = tmp; printf"added: = %d T = %f\n",, T); strcpyfile_out, file_name); strcatfile_out, "_ext.txt"); fp = fopenfile_out, "w"); forj = 0; j <= ; j++) fprintffp, "%f %f\n", j*t/, f[j]); fclosefp); // 5) FFT rdft, 1, f); // a[n] = f[2*n]*2.0/ n = 0, 1, 2,..., M-1) // a[m] = f[1]/ // b[n] = f[2*n+1]*2.0/ n = 1, 2, 3,..., M-1) // b[0] = b[m] = 0 44

7 // 6) M = /2; es[0] = fabsf[0])*2.0/; es[m] = fabsf[1])/; for n = 1; n < M; n++) { es[n] = sqrtf[2*n]*f[2*n]+f[2*n+1]*f[2*n+1])*2.0/; // 7) for n = 0; n <= M; n++) order[n] = n; for n = 2; n < M; n++) { for k = 1; k < n; k++) if es[k] < es[n]) break; tmp = es[n]; for i = n; i > k; i--) { es[i] = es[i-1]; order[i] = order[i-1]; es[k] = tmp; order[k] = n; // 8) strcpyfile_out, file_name); strcatfile_out, "_FFT.txt"); fp = fopenfile_out, "w"); n = 0; fprintffp, "%d %d %f %f %f %f %f %f\n",, n, n/t, f[n]*2.0/, zero, es[n], es[n]/es[1], T); fprintffp, "%d %d %f %f %f %f %f\n", M, M, M/T, f[1]/, zero, es[m], es[m]/es[1]); for k = 1; k < M; k++) { n = order[k]; fprintffp, "%d %d %f %f %f %f %f\n", k, n, n/t, f[2*n]*2.0/, f[2*n+1]*2.0/, es[k], es[k]/es[1]); return 0; 6) es[0] es[1] es[2] es[m] 7.7) a 0 s 1 s M 1 a M es[0] = 2a 0 es[n] = 2s n n = 1, 2,, M 1 es[m] = a M 7) n = 1, 2,, 1 8) 1) flu04 flu04_fft.txt 1 T n = T 2a 0 0 2a 0 2a 0 2s max T s max s 1 s 2 s 1 2 n = M 45

8 M M M T a M 0 a M a M 2s max 3 n = 1, 2,, 1 n 2s 1 2s 2 2s M 1 k 2s n k+2 k n n T 2a n 2b n 2s n 2s n 3 n T 2s max Figure 7.1: octave 4 Do flute harp piano tuba violin csc10.tar Linux flu04.txt har04.txt pia04.txt 46

9 tub04.txt vio04.txt flute harp piano tuba violin octave 4 Do fft_h_order.c fft_h_order./run.sh Linux flute octave 4 Do fft_h_order flu04 flu04.txt flu04_fft.txt 2s max Figure 7.1 flute octave 4 Do gnuplot Linux harp piano tuba violin octave 4 Do gnuplot Figure {f 0, f 1, f 2,, f 1 7.2) a 0 a 1 a 2 a 1 b 1 b 2 b 1 7.3) a 0 a 1 a 2 a M b 1 b 2 b M 1 7.2) 7.5) 7.6) {f 0, f 1, f 2,, f 1 = 2M a n =a n b n = b n 7.6) n = 1, 2,, M 1 f j = 2a 0) 2 + a M cos 2Mπj M 1 + ) 2nπj 2s n cos ψ n j = 0, 1, 2,, 1) s max s 1 s 2 s 1 s n > s max /2 n f [1] j j = 0, 1, 2,, 1 f [1] j = 2a 0) + a M cos 2Mπj 2 + ) 2nπj 2s n cos ψ n. s n >s max /2 m = 2, 3, s n > s max /2 m n f [m] j j = 0, 1, 2,, 1 f [m] j = 2a 0) + a M cos 2Mπj 2 + ) 2nπj 2s n cos ψ n. s n >s max /2 m 47

10 { idft.c idft.c f [m] 0, f [m] 1,, f [m] 1 m 7.2) { 7.5) 7.6) {f 0, f 1,, f 1 f [m] 0, f [m] 1,, f [m] 1 m = 1, 2,, 9 1) fft_h_order.c 8) flu04.txt flu04_fft 2) a[0] a[1] a[2] a[m] b[1] b[2] b[m-1] 7.5) a 0 a 1 a 2 a M b 1 b 2 b M 1 a[n] = 2a n n = 0, 1, 2,, M 1 a[m] = a M b[n] = 2b n n = 1, 2,, M 1 /* idfc.c */ #include <stdio.h> #include <math.h> #include <string.h> #define MAX 32768) #define MAXH 16387) int main ) { int, M, i, j, k, n, flag, order[maxh+1]; double T, f[max+1], a[maxh+1], b[maxh+1], es[maxh+1]; FILE *fp; char file_name[100], file_in[100], file_out[100], file_add[100]; int ktmp1, ktmp2; double dt, dtmp1, dtmp2, dtmp3, dtmp4, dtmp5; // 1) printf"filename = "); scanf"%s", file_name); strcpyfile_in, file_name); strcatfile_in, ".txt"); fp = fopenfile_in, "r"); // 2) fscanffp, "%d %d %lf %lf %lf %lf %lf %lf", &, &ktmp2, &dtmp1, &a[0], &dtmp2, &dtmp3, &dtmp4, &T); fscanffp, "%d %d %lf %lf %lf %lf %lf", &ktmp1, &ktmp2, &dtmp1, &dtmp2, &dtmp3, &dtmp4, &dtmp5); M = ktmp1; a[m] = dtmp2; k = 1; flag = 1; while 1) { flag = fscanffp, "%d %d %lf %lf %lf %lf %lf", &ktmp1, &n, &dtmp1, &dtmp2, &dtmp3, &dtmp4, &es[k]); if flag == EOF) break; order[k] = n; a[n] = dtmp2; b[n] = dtmp3; k = k+1; fclosefp); 48

11 // 3) dt = T/; for j = 0; j <= ; j++) f[j] = a[0]/2.0 + a[m]*cos2.0*m*m_pi*j/); k = 1; dtmp1 = 1.0; for i = 0; i <= 8; i++) { dtmp1 = dtmp1/2.0; printf"i = %d: ", i, k); while es[k]/es[1] >= dtmp1) { n = order[k]; for j = 0; j <= ; j++) f[j] = f[j] + a[n]*cos2.0*n*m_pi*j/) + b[n]*sin2.0*n*m_pi*j/); k = k + 1; if k > M) break; strcpyfile_out, file_name); sprintffile_add, "_IDFT%1d%05d.txt", i+1, k-1); strcatfile_out, file_add); fp = fopenfile_out, "w"); for j = 0; j <= ; j++) fprintffp, "%f %f\n", j*dt, f[j]); fclosefp); printf"%s includes until %d\n", file_out, k-1); return 0; 3) 1) flu04_fft s n > s max /2 n 9 s n > s max /2 2 n 21 s n > s max /2 3 n 40 s n > s max /2 9 n 827 { f [1] 0, f [1] 1,, f [1] flu04_fft_idft txt { f [2] 0, f [2] 1,, f [2] flu04_fft_idft txt { f [3] 0, f [3] 1,, f [3] flu04_fft_idft txt { f [9] 0, f [9] 1,, f [9] flu04_fft_idft txt f [m] idft.c idft cc -O2 idft.c -lm -o idft = f [m] 0 m = 1, 2,, 9 49

12 Linux & Windows flute octave 4 Do Linux idft flu04_fft flute octave 4 Do 9 flu04_fft_idft txt flu04_fft_idft txt flu04_fft_idft txt 9 flu04.txt Windows spwave spwave flu04_fft_idft txt Text with Time Linux & Windows Linux idft har04_fft harp octave 4 Do pia04_fft tub04_fft vio04_fft piano tuba violin octave 4 Do Windows spwave sound wav files cats dogs Windows sound_wav_files sound_wav_files_cats_dogs Windows.wav flu02.wav flute octave 3 Mi 9 1) 3) 8) Windows 5) 6) Linux 4) 7) Windows Linux 1) spwave flu02.wav 2) ) Text with Time.txt 50

13 4) Linux 5) fft_h_order FFT FFT 6) idft 7) 6) Windows 8) spwave Windows Linux & Windows 1) 8) flu01.wav flu02.wav flu03.wav flu05.wav flu06.wav flu07.wav har01.wav har02.wav har03.wav har05.wav har06.wav har07.wav pia01.wav pia02.wav pia03.wav pia05.wav pia06.wav pia07.wav tub01.wav tub02.wav tub03.wav tub05.wav tub06.wav tub07.wav vio01.wav vio02.wav vio03.wav vio05.wav vio06.wav vio07.wav 3 Windows Linux & Windows sound_wav_files_cats_dogs cat1.wav cat2.wav cat3.wav cat4.wav cat1.wav cat4.wav 3 1 1) 8) set terminal postscript set output "filename.ps" replot set terminal postscript eps color 51

14 set output "filename.eps" replot filename Windows Linux & Windows sound_wav_files_cats_dogs 1) 8) dog1.wav dog2.wav dog3.wav dog4.wav dog b1.wav dog b2.wav dog b3.wav dog b4.wav dog b5.wav dog b6.wav dog b7.wav dog b8.wav dog b9.wav dog bss1.wav dog bss2.wav dog bss3.wav dog bss4.wav dog1.wav dog2.wav dog3.wav dog4.wav dog b1.wav dog b2.wav dog b3.wav dog b4.wav dog b5.wav dog b6.wav dog b7.wav dog b8.wav dog b9.wav 3 dog3.wav dog4.wav dog bss1.wav dog bss4.wav springer spaniel Windows Linux & Windows

6 6.1 sound_wav_files flu00.wav.wav 44.1 khz 1/44100 spwave Text with Time spwave t T = N t N 44.1 khz t = 1 sec j t f j {f 0, f 1, f 2,, f N 1

6 6.1 sound_wav_files flu00.wav.wav 44.1 khz 1/44100 spwave Text with Time spwave t T = N t N 44.1 khz t = 1 sec j t f j {f 0, f 1, f 2,, f N 1 6 6.1 sound_wav_files flu00.wav.wav 44.1 khz 1/44100 spwave Text with Time spwave t T = t 44.1 khz t = 1 sec 44100 j t f j {f 0, f 1, f 2,, f 1 6.2 T {f 0, f 1, f 2,, f 1 T ft) f j = fj t) j = 0, 1, 2,,

More information

[1] #include<stdio.h> main() { printf("hello, world."); return 0; } (G1) int long int float ± ±

[1] #include<stdio.h> main() { printf(hello, world.); return 0; } (G1) int long int float ± ± [1] #include printf("hello, world."); (G1) int -32768 32767 long int -2147483648 2147483647 float ±3.4 10 38 ±3.4 10 38 double ±1.7 10 308 ±1.7 10 308 char [2] #include int a, b, c, d,

More information

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè11²ó – ½ÉÂꣲ¤Î²òÀ⡤±é½¬£² –

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè11²ó – ½ÉÂꣲ¤Î²òÀ⡤±é½¬£² – (2018) 11 2018 12 13 2 g v dv x dt = bv x, dv y dt = g bv y (1) b v 0 θ x(t) = v 0 cos θ ( 1 e bt) (2) b y(t) = 1 ( v 0 sin θ + g ) ( 1 e bt) g b b b t (3) 11 ( ) p14 2 1 y 4 t m y > 0 y < 0 t m1 h = 0001

More information

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v 1 http://www7.bpe.es.osaka-u.ac.jp/~kota/classes/jse.html [email protected] /* do-while */ #include #include int main(void) double val1, val2, arith_mean, geo_mean; printf( \n );

More information

: CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and Technology

: CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and Technology I117 8 1 School of Information Science, Japan Advanced Institute of Science and Technology : CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and

More information

(5 B m e i 2π T mt m m B m e i 2π T mt m m B m e i 2π T mt B m (m < 0 C m m (6 (7 (5 g(t C 0 + m C m e i 2π T mt (7 C m e i 2π T mt + m m C m e i 2π T

(5 B m e i 2π T mt m m B m e i 2π T mt m m B m e i 2π T mt B m (m < 0 C m m (6 (7 (5 g(t C 0 + m C m e i 2π T mt (7 C m e i 2π T mt + m m C m e i 2π T 2.6 FFT(Fast Fourier Transform 2.6. T g(t g(t 2 a 0 + { a m b m 2 T T 0 2 T T 0 (a m cos( 2π T mt + b m sin( 2π mt ( T m 2π g(t cos( T mtdt m 0,, 2,... 2π g(t sin( T mtdt m, 2, 3... (2 g(t T 0 < t < T

More information

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1:

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1: 005 9 7 1 1.1 1 Hello World!! 5 p r i n t f ( H e l l o World!! \ n ) ; 7 return 0 ; 8 } 1: 1 [ ] Hello World!! from Akita National College of Technology. 1 : 5 p r i n t f ( H e l l o World!! \ n ) ;

More information

1 4 2 EP) (EP) (EP)

1 4 2 EP) (EP) (EP) 2003 2004 2 27 1 1 4 2 EP) 5 3 6 3.1.............................. 6 3.2.............................. 6 3.3 (EP)............... 7 4 8 4.1 (EP).................... 8 4.1.1.................... 18 5 (EP)

More information

新版明解C言語 実践編

新版明解C言語 実践編 2 List - "max.h" a, b max List - max "max.h" #define max(a, b) ((a) > (b)? (a) : (b)) max List -2 List -2 max #include "max.h" int x, y; printf("x"); printf("y"); scanf("%d", &x); scanf("%d", &y); printf("max(x,

More information

comment.dvi

comment.dvi ( ) (sample1.c) (sample1.c) 2 2 Nearest Neighbor 1 (2D-class1.dat) 2 (2D-class2.dat) (2D-test.dat) 3 Nearest Neighbor Nearest Neighbor ( 1) 2 1: NN 1 (sample1.c) /* -----------------------------------------------------------------

More information

double float

double float 2015 3 13 1 2 2 3 2.1.......................... 3 2.2............................. 3 3 4 3.1............................... 4 3.2 double float......................... 5 3.3 main.......................

More information

1 28 6 12 7 1 7.1...................................... 2 7.1.1............................... 2 7.1.2........................... 2 7.2...................................... 3 7.3...................................

More information

C

C C 1 2 1.1........................... 2 1.2........................ 2 1.3 make................................................ 3 1.4....................................... 5 1.4.1 strip................................................

More information

C 2 / 21 1 y = x 1.1 lagrange.c 1 / Laglange / 2 #include <stdio.h> 3 #include <math.h> 4 int main() 5 { 6 float x[10], y[10]; 7 float xx, pn, p; 8 in

C 2 / 21 1 y = x 1.1 lagrange.c 1 / Laglange / 2 #include <stdio.h> 3 #include <math.h> 4 int main() 5 { 6 float x[10], y[10]; 7 float xx, pn, p; 8 in C 1 / 21 C 2005 A * 1 2 1.1......................................... 2 1.2 *.......................................... 3 2 4 2.1.............................................. 4 2.2..............................................

More information

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裵²ó ¨¡ À©¸æ¹½Â¤¡§¾ò·ïʬ´ô ¨¡

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裵²ó  ¨¡ À©¸æ¹½Â¤¡§¾ò·ïʬ´ô ¨¡ (2018) 2018 5 17 0 0 if switch if if ( ) if ( 0) if ( ) if ( 0) if ( ) (0) if ( 0) if ( ) (0) ( ) ; if else if ( ) 1 else 2 if else ( 0) 1 if ( ) 1 else 2 if else ( 0) 1 if ( ) 1 else 2 (0) 2 if else

More information

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 1. 1.1. 1.2. 1 PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 2. 2.1. 2 1 2 C a b N: PC BC c 3C ac b 3 4 a F7 b Y c 6 5 a ctrl+f5) 4 2.2. main 2.3. main 2.4. 3 4 5 6 7 printf printf

More information

超初心者用

超初心者用 3 1999 10 13 1. 2. hello.c printf( Hello, world! n ); cc hello.c a.out./a.out Hello, world printf( Hello, world! n ); 2 Hello, world printf n printf 3. ( ) int num; num = 100; num 100 100 num int num num

More information

1.3 2 gnuplot> set samples gnuplot> plot sin(x) sin gnuplot> plot [0:6.28] [-1.5:1.5] sin(x) gnuplot> plot [-6.28:6.28] [-1.5:1.5] sin(x),co

1.3 2 gnuplot> set samples gnuplot> plot sin(x) sin gnuplot> plot [0:6.28] [-1.5:1.5] sin(x) gnuplot> plot [-6.28:6.28] [-1.5:1.5] sin(x),co gnuplot 8 gnuplot 1 1.1 gnuplot gnuplot 2D 3D gnuplot ( ) gnuplot UNIX Windows Machintosh Excel gnuplot C 1.2 web gnuplot $ gnuplot gnuplot gnuplot> exit 1 1.3 2 gnuplot> set samples 1024 1024 gnuplot>

More information

2014 3 10 5 1 5 1.1..................................... 5 2 6 2.1.................................... 6 2.2 Z........................................ 6 2.3.................................. 6 2.3.1..................

More information

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裶²ó ¨¡ À©¸æ¹½Â¤¡§·«¤êÊÖ¤· ¨¡

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裶²ó  ¨¡ À©¸æ¹½Â¤¡§·«¤êÊÖ¤· ¨¡ (2018) 2018 5 24 ( ) while ( ) do while ( ); for ( ; ; ) while int i = 0; while (i < 100) { printf("i = %3d\n", i); i++; while int i = 0; i while (i < 100) { printf("i = %3d\n", i); i++; while int i =

More information

θ (t) ω cos θ(t) = ( : θ, θ. ( ) ( ) ( 5) l () θ (t) = ω sin θ(t). ω := g l.. () θ (t) θ (t)θ (t) + ω θ (t) sin θ(t) =. [ ] d dt θ (t) ω cos θ(t

θ (t) ω cos θ(t) = ( : θ, θ. ( ) ( ) ( 5) l () θ (t) = ω sin θ(t). ω := g l.. () θ (t) θ (t)θ (t) + ω θ (t) sin θ(t) =. [ ] d dt θ (t) ω cos θ(t 7 8, /3/, 5// http://nalab.mind.meiji.ac.jp/~mk/labo/text/furiko/ l (, simple pendulum) m g mlθ (t) = mg sin θ(t) () θ (t) + ω sin θ(t) =, ω := ( m ) ( θ ) sin θ θ θ (t) + ω θ(t) = ( ) ( ) g l θ(t) = C

More information

18 C ( ) hello world.c 1 #include <stdio.h> 2 3 main() 4 { 5 printf("hello World\n"); 6 } [ ] [ ] #include <stdio.h> % cc hello_world.c %./a.o

18 C ( ) hello world.c 1 #include <stdio.h> 2 3 main() 4 { 5 printf(hello World\n); 6 } [ ] [ ] #include <stdio.h> % cc hello_world.c %./a.o 18 C ( ) 1 1 1.1 hello world.c 5 printf("hello World\n"); 6 } [ ] [ ] #include % cc hello_world.c %./a.out Hello World [a.out ] % cc hello_world.c -o hello_world [ ( ) ] (K&R 4.1.1) #include

More information

ex14.dvi

ex14.dvi 1,, 0, b (b b 2 b ) n k n = n j b j, (0 n j b 1), n =(n k n k 1...n 1 n 0 ) b, n j j j +1, 0,...,b 1 (digit). b b, n b 1 ñ, ñ = k (b 1 n j )b j b N, n b n, n = b N n, n =ñ+1 b N, n m n + m (mod b N ),

More information

C言語によるアルゴリズムとデータ構造

C言語によるアルゴリズムとデータ構造 Algorithms and Data Structures in C 4 algorithm List - /* */ #include List - int main(void) { int a, b, c; int max; /* */ Ÿ 3Ÿ 2Ÿ 3 printf(""); printf(""); printf(""); scanf("%d", &a); scanf("%d",

More information

program.dvi

program.dvi 2001.06.19 1 programming semi ver.1.0 2001.06.19 1 GA SA 2 A 2.1 valuename = value value name = valuename # ; Fig. 1 #-----GA parameter popsize = 200 mutation rate = 0.01 crossover rate = 1.0 generation

More information

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * *

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * * 2015 2015 07 30 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) +

More information

コンピュータ概論

コンピュータ概論 4.1 For Check Point 1. For 2. 4.1.1 For (For) For = To Step (Next) 4.1.1 Next 4.1.1 4.1.2 1 i 10 For Next Cells(i,1) Cells(1, 1) Cells(2, 1) Cells(10, 1) 4.1.2 50 1. 2 1 10 3. 0 360 10 sin() 4.1.2 For

More information

新・明解C言語 ポインタ完全攻略

新・明解C言語 ポインタ完全攻略 2 1-1 1-1 /* 1-1 */ 1 int n = 100; int *p = &n; printf(" n %d\n", n); /* n int */ printf("*&n %d\n", *&n); /* *&n int */ printf(" p %p\n", p); /* p int * */ printf("&*p %p\n", &*p); /* &*p int * */ printf("sizeof(n)

More information

:30 12:00 I. I VI II. III. IV. a d V. VI

:30 12:00 I. I VI II. III. IV. a d V. VI 2018 2018 08 02 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF N N y N x N xy yx : yxxyxy N N x, y N (parse tree) (1) yxyyx (2) xyxyxy (3) yxxyxyy (4) yxxxyxxy N y N x N yx

More information

橡Pro PDF

橡Pro PDF 1 void main( ) char c; /* int c; */ int sum=0; while ((c = getchar())!= EOF) if(isdigit(c) ) sum += (c-'0'); printf("%d\n", sum); main()int i,sum=0; for(i=0;i

More information

j x j j j + 1 l j l j = x j+1 x j, n x n x 1 = n 1 l j j=1 H j j + 1 l j l j E

j x j j j + 1 l j l j = x j+1 x j, n x n x 1 = n 1 l j j=1 H j j + 1 l j l j E 8 9 7 6 4 2 3 5 1 j x j j j + 1 l j l j = x j+1 x j, n x n x 1 = n 1 l j j=1 H j j + 1 l j l j E a n 1 H = ae l j, j=1 l j = x j+1 x j, x n x 1 = n 1 j=1 l j, l j = ±l l > 0) n 1 H = ϵ l j, j=1 ϵ e x x

More information

ファイル入出力

ファイル入出力 C プログラミング Ⅱ の基礎 とは ファイルへデータを書き込んだり ( 出力 ), ファイルからデータを読み込んだり ( 入力 ) する C 言語では キーボードからの入力 画面への出力と同じようなコードで 処理を実現できる プログラム 入力 出力 ファイル 出力 入力 2 入出力の基本 ストリーム プログラム上で様々な装置への入出力を行う機構様々な入出力装置を統一的な方法で扱うことができる ハードディスクなどではファイルデータによって入出力が行われる

More information

PowerPoint Presentation

PowerPoint Presentation p.130 p.198 p.208 2 double weight[num]; double min, max; min = max = weight[0]; for( i= 1; i i < NUM; i++ ) ) if if ( weight[i] > max ) max = weight[i]: if if ( weight[i] < min ) min = weight[i]: weight

More information

Microsoft Word - C.....u.K...doc

Microsoft Word - C.....u.K...doc C uwêííôöðöõ Ð C ÔÖÐÖÕ ÐÊÉÌÊ C ÔÖÐÖÕÊ C ÔÖÐÖÕÊ Ç Ê Æ ~ if eíè ~ for ÒÑÒ ÌÆÊÉÉÊ ~ switch ÉeÍÈ ~ while ÒÑÒ ÊÍÍÔÖÐÖÕÊ ~ 1 C ÔÖÐÖÕ ÐÊÉÌÊ uê~ ÏÒÏÑ Ð ÓÏÖ CUI Ô ÑÊ ÏÒÏÑ ÔÖÐÖÕÎ d ÈÍÉÇÊ ÆÒ Ö ÒÐÑÒ ÊÔÎÏÖÎ d ÉÇÍÊ

More information

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l C/C++ 2007 6 18 1 C STL(1) 2 1.1............................................... 2 1.2 stdio................................................ 3 1.3.......................................... 10 2 11 2.1 sizeof......................................

More information

新・明解C言語 実践編

新・明解C言語 実践編 第 1 章 見 21 1-1 見えないエラー 見 List 1-1 "max2x1.h" a, b max2 List 1-1 chap01/max2x1.h max2 "max2x1.h" #define max2(a, b) ((a) > (b)? (a) : (b)) max2 List 1-2 List 1-2 chap01/max2x1test.c max2 #include

More information

第7章 有限要素法のプログラミング

第7章 有限要素法のプログラミング April 3, 2019 1 / 34 7.1 ( ) 2 Poisson 2 / 34 7.2 femfp.c [1] main( ) input( ) assem( ) ecm( ) f( ) solve( ) gs { solve( ) output( ) 3 / 34 7.3 fopen() #include FILE *fopen(char *fname, char

More information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) { double

More information

untitled

untitled Q 8 1 8.1 (C++) C++ cin cout 5 C++ 16 6 p.63 8.3 #include 7 showbase noshowbase showpoint noshowpoint 8.3 uppercase 16 nouppercase 16 setfill(int) setprecision(int) setw(int) setbase(int) dec

More information

12.2 電気回路網に関するキルヒホッフの法則による解法 2 多元連立 1 次方程式の工学的応用についての例を 2 つ示す.1 つはブリッジ T 型回路, もう 1 つはホーイストンブリッジ回路である. 示された回路図と与えられた回路定数からキルヒホッフの法則を使って多元連立 1 次方程式を導出する

12.2 電気回路網に関するキルヒホッフの法則による解法 2 多元連立 1 次方程式の工学的応用についての例を 2 つ示す.1 つはブリッジ T 型回路, もう 1 つはホーイストンブリッジ回路である. 示された回路図と与えられた回路定数からキルヒホッフの法則を使って多元連立 1 次方程式を導出する 12.2 電気回路網に関するキルヒホッフの法則による解法 2 多元連立 1 次方程式の工学的応用についての例を 2 つ示す.1 つはブリッジ T 型回路, もう 1 つはホーイストンブリッジ回路である. 示された回路図と与えられた回路定数からキルヒホッフの法則を使って多元連立 1 次方程式を導出する. その式のパラメータを前述のプログラムに反映させてシミュレーションを行う. 12.2.0 キルヒホッフの法則

More information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) double

More information

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D II 8 2003 11 12 1 6 ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 Daisuke 8 =>. 73 Daisuke 35 Hiroshi 64 Ichiro 87 Junko

More information

untitled

untitled II yacc 005 : 1, 1 1 1 %{ int lineno=0; 3 int wordno=0; 4 int charno=0; 5 6 %} 7 8 %% 9 [ \t]+ { charno+=strlen(yytext); } 10 "\n" { lineno++; charno++; } 11 [^ \t\n]+ { wordno++; charno+=strlen(yytext);}

More information

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裱£²²ó ¡Ý½ÉÂꣲ¤Î²òÀ⡤±é½¬£²¡Ý

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裱£²²ó  ¡Ý½ÉÂꣲ¤Î²òÀ⡤±é½¬£²¡Ý (2018) 2018 7 5 f(x) [ 1, 1] 3 3 1 3 f(x) dx c i f(x i ) 1 0 i=1 = 5 ) ( ) 3 ( 9 f + 8 5 9 f(0) + 5 3 9 f 5 1 1 + sin(x) θ ( 1 θ dx = tan 1 + sin x 2 π ) + 1 4 1 3 [a, b] f a, b double G3(double (*f)(),

More information

2017 p vs. TDGL 4 Metropolis Monte Carlo equation of continuity s( r, t) t + J( r, t) = 0 (79) J s flux (67) J (79) J( r, t) = k δf δs s( r,

2017 p vs. TDGL 4 Metropolis Monte Carlo equation of continuity s( r, t) t + J( r, t) = 0 (79) J s flux (67) J (79) J( r, t) = k δf δs s( r, 27 p. 47 7 7. vs. TDGL 4 Metropolis Monte Carlo equation of continuity s( r, t) t + J( r, t) = (79) J s flux (67) J (79) J( r, t) = k δf δs s( r, t) t = k δf δs (59) TDGL (8) (8) k s t = [ T s s 3 + ξ

More information

Minimum C Minimum C Minimum C BNF T okenseq W hite Any D

Minimum C Minimum C Minimum C BNF T okenseq W hite Any D 6 2019 5 14 6.1 Minimum C....................... 6 1 6.2....................................... 6 7 6.1 Minimum C Minimum C BNF T okenseq W hite Any Digit ::= 0 1 2... 9. Number ::= Digit Digit. Alphabet

More information

USB 0.6 https://duet.doshisha.ac.jp/info/index.jsp 2 ID TA DUET 24:00 DUET XXX -YY.c ( ) XXX -YY.txt() XXX ID 3 YY ID 5 () #define StudentID 231

USB 0.6 https://duet.doshisha.ac.jp/info/index.jsp 2 ID TA DUET 24:00 DUET XXX -YY.c ( ) XXX -YY.txt() XXX ID 3 YY ID 5 () #define StudentID 231 0 0.1 ANSI-C 0.2 web http://www1.doshisha.ac.jp/ kibuki/programming/resume p.html 0.3 2012 1 9/28 0 [ 01] 2 10/5 1 C 2 3 10/12 10 1 2 [ 02] 4 10/19 3 5 10/26 3 [ 03] 6 11/2 3 [ 04] 7 11/9 8 11/16 4 9 11/30

More information

file"a" file"b" fp = fopen("a", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen("b", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose

filea fileb fp = fopen(a, r); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen(b, r); while(fgets(line, BUFSIZ, fp)) {... fclose I117 9 2 School of Information Science, Japan Advanced Institute of Science and Technology file"a" file"b" fp = fopen("a", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen("b", "r"); while(fgets(line,

More information

情報活用資料

情報活用資料 y = Asin 2πt T t t = t i i 1 n+1 i i+1 Δt t t i = Δt i 1 ( ) y i = Asin 2πt i T 21 (x, y) t ( ) x = Asin 2πmt y = Asin( 2πnt + δ ) m, n δ (x, y) m, n 22 L A x y A L x 23 ls -l gnuplot gnuplot> plot "sine.dat"

More information

II No.01 [n/2] [1]H n (x) H n (x) = ( 1) r n! r!(n 2r)! (2x)n 2r. r=0 [2]H n (x) n,, H n ( x) = ( 1) n H n (x). [3] H n (x) = ( 1) n dn x2 e dx n e x2

II No.01 [n/2] [1]H n (x) H n (x) = ( 1) r n! r!(n 2r)! (2x)n 2r. r=0 [2]H n (x) n,, H n ( x) = ( 1) n H n (x). [3] H n (x) = ( 1) n dn x2 e dx n e x2 II No.1 [n/] [1]H n x) H n x) = 1) r n! r!n r)! x)n r r= []H n x) n,, H n x) = 1) n H n x) [3] H n x) = 1) n dn x e dx n e x [4] H n+1 x) = xh n x) nh n 1 x) ) d dx x H n x) = H n+1 x) d dx H nx) = nh

More information

資料

資料 PC PC C VMwareをインストールする Tips: VmwareFusion *.vmx vhv.enable = TRUE Tips: Windows Hyper-V -rwxr-xr-x 1 masakazu staff 8552 7 29 13:18 a.out* -rw------- 1 masakazu staff 8552 7 29

More information

kiso2-06.key

kiso2-06.key 座席指定があります Linux を起動して下さい 第6回 計算機基礎実習II 計算機基礎実習II 2018 のウェブページか ら 以下の課題に自力で取り組んで下さい 第5回の復習課題(rev05) 第6回の基本課題(base06) 第5回課題の回答例 ex05-2.c 1. キーボードから整数値 a を入力すると a*a*a の値を出力することを繰り返すプログラムを作成しなさい 2. ただし 入力された

More information

joho12.ppt

joho12.ppt n φ 1 (x),φ 2 (x),,φ n (x) (x i, f i ) Q n c 1,,c n (,f k ) q n = c i φ i (x) x Q n i=1 c 1 = 0 c 1 n ( c 1 ) = q n f k 2 Q n ( c 1 ) = q 2 2 n ( ) 2 f k q n ( ) + f k Q n c 1 = c 1 q n 2 q n( ) q n q

More information

Bessel ( 06/11/21) Bessel 1 ( ) 1.1 0, 1,..., n n J 0 (x), J 1 (x),..., J n (x) I 0 (x), I 1 (x),..., I n (x) Miller (Miller algorithm) Bess

Bessel ( 06/11/21) Bessel 1 ( ) 1.1 0, 1,..., n n J 0 (x), J 1 (x),..., J n (x) I 0 (x), I 1 (x),..., I n (x) Miller (Miller algorithm) Bess Bessel 5 3 11 ( 6/11/1) Bessel 1 ( ) 1.1, 1,..., n n J (x), J 1 (x),..., J n (x) I (x), I 1 (x),..., I n (x) Miller (Miller algorithm) Bessel (6 ) ( ) [1] n n d j J n (x), d j I n (x) Deuflhard j= j=.1

More information

mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( )

mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) 2008 3 10 1 mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) stream FILE ( man ) 40 ( ) %./a.out String : test

More information

1 3 1.1.......................... 3 1............................... 3 1.3....................... 5 1.4.......................... 6 1.5........................ 7 8.1......................... 8..............................

More information

2 P.S.P.T. P.S.P.T. wiki 26

2 P.S.P.T. P.S.P.T. wiki  26 P.S.P.T. C 2011 4 10 2 P.S.P.T. P.S.P.T. wiki [email protected] http://www23.atwiki.jp/pspt 26 3 2 1 C 8 1.1 C................................................ 8 1.1.1...........................................

More information