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 CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by