Why do I get an error on line 17?

clc
deviation = (1) .^ 0.5;
n = deviation .* randn(100000, 1); % noise
t = [-5: 0.01: 4.99]; % time
p = 5 .* sin(20 .* pi .* t + (pi / 4)); % pulse p(t)
T = (2 * 1500) / 1000;
t2 = t - T;
p2 = 5 * sin(20 .* pi .* t2 + (pi / 4));
r = p2 + n;
x = randn(length(t), 1);
i = (t - T);
y = linfilt(x, i, length(t));
figure(1);
subplot(3, 1, 1);
plot(t, p);
title('Plot 4a: Pulse p(t)'); % pulse p(t)
xlabel('Time');
ylabel('Amplitude');
grid;
subplot(3, 1, 2);
plot(t2, r);
title('Plot 4b: Received Signal r(t)'); % received signal r(t)
xlabel('Time');
ylabel('Amplitude');
axis([-5 4.99 min(y) max(y)]);
grid;
[C, tau] = xcorr(r,p); % cross-correlation R_rp(tau)
subplot(3, 1, 3);
plot(tau, C);
title('Plot 3c: Cross-Correlation R_rp(tau)');
grid;

2 Comments

We do not know which is line 17. Also, linfit() is not a MATLAB routine. There are several linfit() in the File Exchange, but we would not know which one of those you are using.
?What is this function linfilt?

Sign in to comment.

Answers (0)

Asked:

on 7 May 2018

Commented:

on 7 May 2018

Community Treasure Hunt

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

Start Hunting!