chirp plot(i dont know what`s wrong plz help me)
1 次查看(过去 30 天)
显示 更早的评论
clear all;
close all;
% Aliasing.
ta = 0:1/4000:2/1000;
xa1 = cos(pi * 20000 * ta^2 + 2*pi*1000*ta);
tn = 0:1/8000:2/1000;
xn1 = cos(pi * 20000 * ta^2 + 2*pi*1000*ta);
figure
plot(ta, xa1)
hold on
stem(tn, xn1)
ylabel('x1(t), x1[n]')
title('f1 = 1000 Hz, fs = 8000 Hz')
0 个评论
回答(1 个)
Thiago Henrique Gomes Lobato
2020-6-14
Your code had some errors in respect to element-wise operator (^ instead of .^). Also you use the old time variable for the second signal. This is a version of your code that works:
clear all;
close all;
% Aliasing.
ta = 0:1/4000:2/1000;
xa1 = cos(pi * 20000 * ta.^2 + 2*pi*1000*ta); % note the .^
tn = 0:1/8000:2/1000;
xn1 = cos(pi * 20000 * tn.^2 + 2*pi*1000*tn); % tn instead of ta
figure
plot(ta, xa1)
hold on
stem(tn, xn1)
ylabel('x1(t), x1[n]')
title('f1 = 1000 Hz, fs = 8000 Hz')
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!