chirp plot(i dont know what`s wrong plz help me)

1 回表示 (過去 30 日間)
지성 이
지성 이 2020 年 6 月 14 日
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
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')

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by