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')

回答(1 个)

Thiago Henrique Gomes Lobato
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')

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by