?? frequency_domain_view.m
字號:
clear all;
s=[ones(1,10),zeros(1,90)]; % transmitted signal
s_f=fft(s);
x=s_f([1:50]);
y=s_f([51:100]);
signal_f=[y,x]; %input spectrum
dt=5/10; % each time interval is 0.01 micro sec
df=1/(100*dt);
f_s=df*([0:99]-50);% frequecy vector
an=[1,0.3,-0.8,0.5,-0.4,0.2]; %amplitudes
f=f_s;
w=2*pi*f;
tn_1=[0,1,2,3,4,5]; % arrival times for case 1
for i=1:6;
h1(i,:)=an(i)*exp(-j*w*tn_1(i));
end
h_1=sum(h1(:,1:end));%transfer function
y_1=h_1.*signal_f;%output spectrum
tn_2=[0,0.1,0.2,0.3,0.4,0.5]; % arrival times for case 2
for i=1:6;
h2(i,:)=an(i)*exp(-j*w*tn_2(i));
end
h_2=sum(h2(:,1:end));%transfer function
y_2=h_2.*signal_f;%output spectrum
figure(1)
subplot(2,3,1);
plot(f_s,abs(signal_f));
ylabel('magnitude');title('I/P spectrum')
subplot(2,3,4);
plot(f_s,angle(signal_f));
ylabel('Phase');
xlabel('Frequency(MHz)');
14
subplot(2,3,2);
plot(f,abs(h_1));
title('channel 1')
subplot(2,3,5);
plot(f,angle(h_1));
xlabel('Frequency(MHz)');
subplot(2,3,3);
plot(f,abs(h_2));
title('channel 2')
subplot(2,3,6);
plot(f,angle(h_2));
xlabel('Frequency(MHz)');
figure(2)
subplot(2,3,1);
plot(f_s,abs(signal_f));
ylabel('magnitude');title('I/P spectrum')
subplot(2,3,4);
plot(f_s,angle(signal_f));
ylabel('Phase');
xlabel('Frequency(MHz)');
subplot(2,3,2);
plot(f,abs(y_1));
title('O/P spectrum 1')
subplot(2,3,5);
plot(f,angle(y_1));
xlabel('Frequency(MHz)');
subplot(2,3,3);
plot(f,abs(y_2));
title('O/P spectrum 2')
subplot(2,3,6);
plot(f,angle(y_2));
xlabel('Frequency(MHz)');
%===============================================================
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -