% sin 그래프계산및출력 t = -50 : 1 : 50; T = 10; f = 1/T; Nsin = sin ( ( 2 * pi * f * t ) ) % 시간영역 % 주기 % 주파수 % sin(2πft) % F(sin) 계산 Fsin = fftshift ( fft ( Nsin ) ); % 화면을 2 열 1 행으로나눈후 % 2 열 1 행에 Sin 그래프출력 subplot ( 211 ), plot ( t, Nsin ), xlabel ( 't'), ylabel( 'x(t)'); title ( 'Sin 그래프 '), grid on % 2 열 1 행에 F Sin 그래프출력 subplot ( 212 ), plot ( t, abs( Fsin ) ), grid on title ( 'F Sin 그래프 '), grid on - 1 -
% Rectangular Value 입력 t = -50 : 1 : 50; % 시간영역 for i = 1 : 101 if abs ( t ( i ) ) < 10 x ( i ) = 1; else x ( i ) = 0; % 화면을 2 열 1 행으로나눈후 % 2 열 1 행에 Rectangular 그래프출력 subplot ( 211 ), plot (t, x ), xlabel ( 't'), ylabel( 'x(t)'); axis ( [-50 50-1 2] ); title ( 'Rectangular 그래프 '), grid on ft = fftshift ( fft ( x ) ); % 푸리에변환 % 2 열 1 행에 F Rectangular 그래프출력 subplot ( 212 ), plot ( t, abs( ft ) ), grid on axis ( [-50 50 0 20] ); title ( 'F Rectangular 그래프 '), grid on - 2 -
t = -200 : 1 : 200; T = 50; f = 1/T; x = sinc (2 * pi * f * t ); ft = fftshift ( fft ( x ) ); % 시간영역 % 주기 % 주파수 % sinc Function % F(sinc) % 화면을 2 열 1 행으로나눈후 subplot ( 211 ), plot (t, x ), xlabel ( 't'), ylabel( 'x(t)'); axis ( [-40 40-1 2] ); title ( 'sinc 그래프 '), grid on % 2 열 1 행에 F sinc 그래프출력 subplot ( 212 ), plot ( t, abs ( ft ) ), xlabel ( 'f'), ylabel( 'x(f)'),grid on axis ( [-50 50 0 10] ); title ( 'F sinc 그래프 '), grid on - 3 -
clear all % 모두초기화 t = linspace(-1005, 1005, 2010); %dirac comb for i = 1 : 201 a(i*10) = 1 Fa = fftshift ( fft ( a ) ); % dirac comb 푸리에변환 % dirac comb 그래프 subplot (211), plot ( t, a ), xlabel ( 't'), ylabel( 'x(t)'); axis( [ -100 100 0 1 ]); title ( 'Dirac Comb 그래프 '), grid on %F[dira comb] 그래프 subplot (212), plot ( t, abs (Fa ) ), axis( [ -1000 1000 0 100 ]); xlabel ( 'f'), ylabel( 'X(f)'); title ( 'F Dirac Comb 그래프 '), grid on - 4 -
t = linspace(-100, 100, 200); %dirac delta Value Input for i = 1 : 200 a(i) = 0 a(100) = 1; Fa = fftshift ( fft ( a ) ); % dirac delta 푸리에변환 % dirac delta 그래프 subplot (211), plot ( t, a ), xlabel ( 't'), ylabel( 'x(t)'); axis( [ -100 100 0 1 ]); title ( 'Dirac delta 그래프 '), grid on %F[dira comb] 그래프 subplot (212), plot ( t, abs (Fa ) ), axis( [ -100 100 0 2 ]); xlabel ( 'f'), ylabel( 'X(f)'); title ( 'F Dirac delta 그래프 '), grid on - 5 -
% 1 과 delta Function 은서로푸리에변환하면쌍대성의원리성립 t = linspace(-100, 100, 200); % Value Input for i = 1 : 200 a(i) = 1; Fa = fftshift ( fft ( a ) ); % '1' 푸리에변환 % '1' 그래프 subplot (211), plot ( t, a ), xlabel ( 't'), ylabel( 'x(t)'); axis( [ -100 100 0 2 ]); title ( '1'), grid on %F[1] 그래프 subplot (212), plot ( t, abs (Fa ) ), axis( [ -100 100 0 2 ]); xlabel ( 'f'), ylabel( 'X(f)'); title ( 'F 1 그래프 '), grid on - 6 -
% Gaussian Pulse t = linspace(-1000, 1000, 2000); dt = 50; % 이값을변화시키면작아질수로위로올라가고폭이작아짐 for cnt = 1 : 2000 c(cnt) = dt * exp ( - ( ( pi*( t(cnt)^2 ) ) / ( dt^2 ) ) ); Fa = fftshift ( fft ( c ) ); % Gaussian Pulse 푸리에변환 % Gaussian Pulse 그래프 subplot (211), plot ( t, c ), xlabel ( 't'), ylabel( 'x(t)'); axis( [ -1000 1000 0 100 ]); title ( 'Gaussian Pulse 그래프 '), grid on %F[Gaussian Pulse] 그래프 subplot (212), plot ( t, abs (Fa ) ), axis( [ -500 500 0 4000 ]); xlabel ( 'f'), ylabel( 'X(f)'); title ( 'F Gaussian Pulse] 그래프 '), grid on - 7 -
% sgn Function t = linspace(-100, 100, 200); % Value Input for i = 1 : 100 a(i) = -1; for i = 101 : 200 a(i) = 1; Fa = fftshift ( fft ( a ) ); % 'sgn Function' 푸리에변환 % 'sgn Function' 그래프 subplot (211), plot ( t, a ), xlabel ( 't'), ylabel( 'x(t)'); axis( [ -100 100-2 2 ]); title ( 'sgn Function'), grid on %F[sgn Function] 그래프 subplot (212), plot ( t, abs (Fa ) ), axis( [ -100 100 0 150 ]); xlabel ( 'f'), ylabel( 'X(f)'); title ( 'F sgn Function 그래프 '), grid on - 8 -
% u(t) Function t = linspace(-100, 100, 200); % Value Input for i = 1 : 100 a(i) = 0; for i = 101 : 200 a(i) = 1; Fa = fftshift ( fft ( a ) ); % '1' 푸리에변환 % 'u(t) Function' 그래프 subplot (211), plot ( t, a ), xlabel ( 't'), ylabel( 'x(t)'); axis( [ -100 100-1 2 ]); title ( 'u(t) Function'), grid on %F[u(t) Function] 그래프 subplot (212), plot ( t, abs (Fa ) ), axis( [ -100 100 0 150 ]); xlabel ( 'f'), ylabel( 'X(f)'); title ( 'F u(t) 그래프 '), grid on - 9 -
t = -50 : 1 : 50; % 시간영역 T = 10; f = 1/T; % 주기 % 주파수 Ncos = cos ( ( 2 * pi * f * t ) ); % cos(2πft) 구성 % Rectangular Function 구성 for cnt = 1: 101 if 31 < cnt st ( cnt ) = 1; if cnt > 70 st ( cnt) = 0; % Cos * Rectangular 계산 for cnt = 1 : 101 Gop(cnt) = st ( cnt ) * Ncos( cnt ); % F(Cos * Rectangular) 계산 FGop = fftshift ( fft ( Gop ) ); % 화면을 4열 1행으로나눈후 % 1열 Cos그래프출력 subplot ( 411 ), plot ( t, Ncos ), xlabel ( 't'), ylabel( 'x(t)'); title ( 'Cos 그래프 '), grid on % 2 열 Rectangular 펄스 subplot ( 412 ), plot ( t, st ), xlabel ( 't'), ylabel( 'x(t)'); title ( 'Rectangular 그래프 '), grid on % 3 열 Cos * Rectangular subplot ( 413 ), plot ( t, Gop ), xlabel ( 't'), ylabel( 'x(t)'); title ( 'Cos * Rectangular 그래프 '), grid on % 4 열 F Cos * Rectangular 그래프출력 subplot ( 414 ), plot ( t, abs( FGop ) ), xlabel ( 'f'), ylabel( 'x(f)'); title ( 'F Cos * Rectangular 그래프 '), grid on - 10 -
- 11 -
% cos 그래프계산및출력 t = -50 : 1 : 50; T = 10; f = 1/T; Ncos = cos ( ( 2 * pi * f * t ) ) % 시간영역 % 주기 % 주파수 % cos(2πft) % F(cos) 계산 Fcos = fftshift ( fft ( Ncos ) ); % 화면을 2 열 1 행으로나눈후 % 2 열 1 행에 cos 그래프출력 subplot ( 211 ), plot ( t, Ncos ), xlabel ( 't'), ylabel( 'x(t)'); title ( 'cos 그래프 '), grid on % 2 열 1 행에 F cos 그래프출력 subplot ( 212 ), plot ( t, abs( Fcos ) ), grid on title ( 'F cos 그래프 '), grid on - 12 -
% 정보신호및반송파신호 t = -50 : 1 : 50; T = 10; f = 1/T; Nsin = sin ( ( 2 * pi * f * t ) ) Ncsin = sin ( ( 2 * pi * 2*f * t ) ) % 시간영역 % 주기 % 주파수 % sin(2πft) % 반송파 for i = 1 : 101 gop(i) = Nsin(i) * Ncsin(i); % F(sin) 계산 Fgop = fftshift ( fft ( gop ) ); % 첫번째화면 figure ( 1 ); plot ( t, Nsin ), xlabel ( 't'), ylabel( 'x(t)'); title ( 'Sin 그래프 '), grid on % 두번째화면 figure ( 2 ); plot ( t, Ncsin ), xlabel ( 't'), ylabel( 'x(t)'); title ( ' 반송파 (sin) 그래프 '), grid on % 세번째화면 figure ( 3 ); plot ( t, gop ), xlabel ( 't'), ylabel( 'x(t)'); title ( ' 합쳐진신호그래프 '), grid on % 네번째신호 figure( 4 ); plot ( t, abs( Fgop) ), title ( 'F 합쳐진신호그래프 '), grid off - 1 -
- 2 -
- 3 -
% 정보신호및반송파신호 and 변조신호 t = -10 : 1/1000 : 10; T = 4056; % 시간영역 % 주기 Nsin = sin ( 2 * pi *1* t ) % sin(2πft) 정보신호 Ncsin = 2*cos ( ( 2 * pi * 50 * t ) ) % 반송파 for i = 1 : 10000 gop(i) = Nsin(i) * Ncsin(i); % F(sin) 계산 Fgop = fftshift ( fft ( gop ) ); % 첫번째화면 figure ( 1 ); plot ( t, Nsin, t, Ncsin), xlabel ( 't'), ylabel( 'x(t)'), axis( [ -1 1-2 2 ]); title ( ' 정보신호및반송파신호 '), grid on % 두번째화면 figure ( 2 ); plot ( sin (gop ) ), xlabel ( 't'), ylabel( 'x(t)'); title ( ' 변조신호 '), grid on % 세번째화면 figure( 3 ); plot ( abs( Fgop) ), title ( 'F 변조신호 '), grid off - 1 -
- 2 -
- 3 -
% Modulation Factor(u) 의변화 t = -10 : 1/1000 : 10; T = 4056; % 시간영역 % 주기 % dc offset 값을 0.5, 1, 2 로변화 % 정보신호의 Amax 값및 Amin 값조정변수 % dcoffset=2 ; u = ( 3 + 1 ) / (3-1 ) = 0.5 % dcoffset=1 ;u =( 2-0 ) / ( 2 + 0 ) = 1 % dcoffset=0.5 ;u = ( 1.5+0.5 ) / (1.5-0.5 ) = 2 dcoffset = 0.5 Nsin = sin ( 2 * pi *5* t ) + dcoffset Ncsin = cos ( ( 2 * pi * 50 * t ) ) % 반송파 for i = 1 : 10000 gop(i) = Nsin(i) * Ncsin(i); % F(sin) 계산 Fgop = fftshift ( fft ( gop ) ); % 첫번째화면 figure ( 1 ); plot ( t, Nsin, t, Ncsin), xlabel ( 't'), ylabel( 'x(t)'), axis( [ -0.1 0.1-3 3 ]); title ( ' 정보신호및반송파신호 '), grid on % 두번째화면 figure ( 2 ); plot ( sin (gop ) ), xlabel ( 't'), ylabel( 'x(t)'), axis( [ 0 2000-2 2 ]); title ( ' 변조신호 '), grid on % 세번째화면 figure( 3 ); plot ( abs( Fgop) ), title ( 'F 변조신호 '), grid off, axis( [ 4000 6000-0 10000 ]); - 4 -
- 5 -
- 6 -
- 7 -
- 8 -
- 9 -
% PM 변조및 FM 변조 clear; t=linspace(0,2e-7,2000+1); dt = t(2)-t(1); ts=dt; fs=1/ts; % 변화량 ws=2*pi*fs; A=1; fc=1e8; wc=2*pi*fc; Am=1; fm=fc/10; wm=2*pi*fm; s=am*cos(wm*t); Kf=wc/2; % 주파수변화 x1=a*cos(wc*t+am*kf/wm*sin(wm*t)) % 위상변화 Kp=pi; x2=a*cos(wc*t+kp*s); % 진폭 % 반송파발생 % 정보신호의진폭 % 정보신호발생 % FM변조신호 % PM변조신호 BW=ws/2; w=linspace(-bw, BW, length(t)); dw= w(2)-w(1); % 푸리에변환 F=fftshift(fft(x1))/fs; FT=abs(F); FT2=dw*FT; Fp=fftshift(fft(x2))/fs; FTp=abs(Fp); FT3=dw*FTp; % 출력부분 subplot(511), plot(t,s), title('message Signal'); subplot(512), plot(t,x1), title('fm Modulation'); subplot(513), plot(w,ft2), title('fm Modulation FT'), axis([min(w),max(w),min(ft2),max(ft2)]); subplot(514), plot(t,x2), title('pm Modulation'); subplot(515), plot(w,ft3), title('pm Modulation FT'), axis([min(w),max(w),min(ft3),max(ft3)]); - 1 -
- 2 -
Bessel Function % Bessel Function Kind n'th order t = 0 : 0.1 : 10; a8 = besselj ( t, 8 ); a7 = besselj ( t, 7 ); a6 = besselj ( t, 6 ); a5 = besselj ( t, 5 ) a4 = besselj ( t, 4 ) a3 = besselj ( t, 3 ) a2 = besselj ( t, 2 ) a1 = besselj ( t, 1 ) plot (t, besselj ( t, 8 ), t, besselj ( t, 7 ), t, besselj ( t, 6 ), t, besselj ( t, 5 ),t, besselj ( t, 4), t, besselj ( t, 3), t, besselj ( t, 2), t, besselj ( t, 1)), grid on Data n'th 0 1 2 3 4 5 6 7 8 9 10 order 1 0.765 0.440 0.115 0.020 0.003 0.000 0.000 0.000 0.000 0.000 0.000 2 0.224 0.577 0.353 0.129 0.034 0.007 0.001 0.000 0.000 0.000 0.000 3-0.260 0.339 0.486 0.309 0.132 0.043 0.011 0.003 0.001 0.000 0.000 4-0.397-0.066 0.364 0.430 0.281 0.132 0.049 0.015 0.004 0.001 0.000 5-0.178-0.328 0.047 0.365 0.391 0.261 0.131 0.053 0.018 0.006 0.002 6 0.151-0.277-0.243 0.115 0.358 0.362 0.246 0.130 0.057 0.021 0.007 7 0.300-0.005-0.301-0.168 0.158 0.348 0.339 0.234 0.128 0.059 0.024 8 0.172 0.235-0.113-0.291-0.105 0.186 0.338 0.321 0.224 0.126 0.061-3 -