This commit is contained in:
Diogo Cordeiro 2020-10-08 15:28:47 +01:00
parent 16a3407843
commit 97c9ede3b5
3 changed files with 11 additions and 11 deletions

View File

@ -1,12 +1,12 @@
%% Exercício 5
function DiogoEliseuHugo_TP2_5(X)
plot(X);
fprintf("L_1: %d\n", norma(X,1));
fprintf("L_2: %f\n", norma(X,2));
fprintf("L_3: %f\n", norma(X,3));
fprintf("L_{infinity}: %d\n", max(abs(X)));
fprintf("Energia: %f\n", sum(abs(X).^2));
fprintf("Potência média: %f\n", sum(X.^2) / length(X));
fprintf('L_1: %d\n', norma(X,1));
fprintf('L_2: %f\n', norma(X,2));
fprintf('L_3: %f\n', norma(X,3));
fprintf('L_{infinity}: %d\n', max(abs(X)));
fprintf('Energia: %f\n', sum(abs(X).^2));
fprintf('Potência média: %f\n', sum(X.^2) / length(X));
end
function s = norma(X, P)

View File

@ -37,6 +37,6 @@ plot(y5)
hold off
legend("s","x","y3","y5");
legend('s','x','y3','y5');
errors = ['Ex: ' num2str(DiogoEliseuHugo_TP2_6(x, s)) ' Ey3: ' num2str(DiogoEliseuHugo_TP2_6(y3, s)) ' Ey5: ' num2str(DiogoEliseuHugo_TP2_6(y5, s))];
title(errors)