This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
DSP/TP1/DiogoEliseuHugo_TP1_5.m

15 lines
398 B
Mathematica
Raw Permalink Normal View History

2020-10-05 22:31:12 +01:00
%% Exercício 5
2020-12-14 03:10:51 +00:00
function DiogoEliseuHugo_TP1_5(X)
2020-10-05 22:31:12 +01:00
plot(X);
2020-10-08 15:28:47 +01:00
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));
2020-10-05 22:31:12 +01:00
end
function s = norma(X, P)
s = sum(abs(X).^P).^(1/P);
2020-10-08 15:28:47 +01:00
end