?o = 0.3?0.10.080.060.040.02amplitude0-0.02-0.04-0.06-0.08-0.1051015202530time index35404550
?o = 0.48?0.10.080.060.040.02amplitude0-0.02-0.04-0.06-0.08-0.1051015202530time index35404550
?o = 0.45?0.10.080.060.040.02amplitude0-0.02-0.04-0.06-0.08-0.1051015202530time index35404550
?o = 0.525?0.10.080.060.040.02amplitude0-0.02-0.04-0.06-0.08-0.1051015202530time index35404550
?o = 0.7?0.10.080.060.040.02amplitude0-0.02-0.04-0.06-0.08-0.1051015202530time index35404550
?o = 0.75?0.10.080.060.040.02amplitude0-0.02-0.04-0.06-0.08-0.1051015202530time index35404550
M2.6
Write a MATLAB program to plot a continuous-time sinusoidal signal and its sampled version, and verify Figure 2.28. You need to use the hold function to keep both plots.
t=0:0.001:1;
fo=input('Frequency of sinusoid in Hz='); FT=input('Sampling frequency in Hz='); g1=cos(2*pi*fo*t); plot(t,g1,'-');
xlabel('time'); ylabel('Amplitude'); hold n=0:1:FT;
gs=cos(2*pi*fo*n/FT);
plot(n/FT,gs,'o'); hold off
Frequency of sinusoid in Hz=10 Sampling frequency in Hz=5
10.80.60.40.20-0.2-0.4-0.6-0.8-100.10.20.30.40.5time0.60.70.80.91Amplitude
clf;
w=-4*pi:8*pi/511:4*pi;
num=[0.1323 0.01910412 -0.05978637 0.01910412 0.1323]; den=[1 0.1386 0.8258 0.1393 0.4153]; h=freqz(num,den,w); subplot(2,1,1)
plot(w/pi,real(h));grid
title('(e^{j\\omega})的实部') xlabel('\\omega/\\pi'); ylabel('振幅') subplot(2,1,2)
plot(w/pi,imag(h));grid
title('H(e^{j\\omega}的虚部)') xlabel('\\omega/\\pi'); ylabel('振幅'); pause
subplot(2,1,1)
plot(w/pi,abs(h));grid
title('H(e^{j\\omega})的实部') xlabel('\\omega/\\pi'); ylabel('振幅'); subplot(2,1,2)
plot(w/pi,angle(h));grid
title('[H(e^{j\\omega})]的虚部') xlabel('\\omega/\\pi'); ylabel('振幅');
H(ej?)的实部0.80.6振幅0.40.20-4-3-2-10?/?[H(ej?)]的虚部421234振幅0-2-4-4-3-2-10?/?1234
clf;
w=-4*pi:8*pi/511:4*pi;
num=[0.3192 0.0601692 -0.0601692 -0.3192]; den=[1 0.7856 1.4654 -0.2346]; h=freqz(num,den,w); subplot(2,1,1)
plot(w/pi,real(h));grid
title('(e^{j\\omega})幅度谱') xlabel('\\omega/\\pi'); ylabel('振幅')