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

1 view (last 30 days)
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')

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

Categories

Find more on Programming in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!