ex5: terminated.

This commit is contained in:
rainydaysavings 2020-10-05 22:31:12 +01:00
parent 8e70fdffd1
commit 4fd96c59cb
1 changed files with 14 additions and 0 deletions

14
DiogoEliseuHugo_TP2_5.m Normal file
View File

@ -0,0 +1,14 @@
%% 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));
end
function s = norma(X, P)
s = sum(abs(X).^P).^(1/P);
end