ex14: terminated.

This commit is contained in:
rainydaysavings 2020-10-24 22:38:49 +01:00
parent 79ee14ea5f
commit 73565ff61a
2 changed files with 22 additions and 4 deletions

View File

@ -6,15 +6,18 @@ function [Vmax, Lmax] = DiogoEliseuHugo_TP2_13(X, Y, GRAF)
n4 = 1:(size(Y, 2) * 2) - 1;
n5 = 1:(max(size(X, 2), size(Y, 2)) * 2) - 1;
rxx = xcorr(X, X);
ryy = xcorr(Y, Y);
rxx = xcorr(X);
ryy = xcorr(Y);
X0 = max(rxx);
Y0 = max(ryy);
R0xx = rxx / X0;
R0yy = ryy / Y0;
R0xy = xcorr(X, Y) / sqrt(X0 * Y0);
R0xy = xcorr(X, Y, size(n5, 1)) / sqrt(X0 * Y0);
n5 = size(R0xy, 1);
if (GRAF == 1)
figure
subplot(5,1,1),plot(n1, X)
xlabel('n'),title('$x[n]$', 'Interpreter', 'latex', 'FontSize', 14)
subplot(5,1,2),plot(n2, Y)

View File

@ -0,0 +1,15 @@
%% Exercício 14
function RefN = DiogoEliseuHugo_TP2_14(X)
N = 1:size(X, 2);
ref = [sin(N); exp(N); exp(-N); N; -N; N.^2];
maxim = [];
for s = ref'
Vmax = DiogoEliseuHugo_TP2_13(X, s', 1);
maxim = [maxim Vmax];
end
m = max(maxim);
RefN = find(maxim == m, 1);
end