Comparing a signal reconstruction with given equation

조회 수: 1 (최근 30일)
James Stringer
James Stringer 2016년 2월 15일
답변: Arnab Sen 2016년 2월 23일
I am supposed to compare a signal reconstruction with the given equation g_t = sum(n = 1:20) of g_a*(n/2B)sinc(2piBt-npi) . I am given the values for g_t but mine don't match, can anyone see why? first couple should be 0, 0.016, 0.037...etc
clear; clc
t = 0:0.005:1;
g_t = 0;
g_a = sin(2*pi*t)+(0.5*cos(6*pi*t))+(0.25*cos(18*pi*t));
e_t = 0;
B = 10;
prod1 = 0;
prod7 = 0;
%------------------------------Equation----------------------------------
for n = 1:20
g_t = g_t+(n/20).*g_a.*((sin((2*pi*B*t)-(n*pi)))./((2*pi*B*t)-(n*pi)));
end
e_t = g_a - g_t;
%----------------------------------Plots----------------------------------
figure(1);
hold on;
box on;
plot(t,g_t,'r');
plot(t,g_a,'b');
plot(t,e_t,'y');
ylabel('amplitude g(t)');
xlabel('time t');
title('sync waveform reconstruction');
axis([0 1 -2 2]);
fileID = fopen('Signal Reconstruction.txt', 'w');
fprintf(fileID, '%34s\n','Signal Reconstruction');
fprintf(fileID, '%38s\n','Using Sinc Waveform');
fprintf(fileID, '%2s %8s %7s %9s %7s\n','i','prod1','prod7',...
'gr(t)','delta');
for i = 1:99
fprintf(fileID,'%2.0f %+8.3f %+8.3f %+8.3f %+8.3f\n',i,...
prod1,prod7,g_t(i),e_t(i));
end

답변 (1개)

Arnab Sen
Arnab Sen 2016년 2월 23일
Hi James ,
I observe some inconsistency in the definition of 'g_t' and compute of 'g_t' in the code.
I think as per the definition 'g_t' should be as follows:
for n = 1:20
g_t = g_t+(n/2*B).*g_a.*(sinc((2*pi*B*t)));
end

카테고리

Help CenterFile Exchange에서 Waveform Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by