norms_Math_unsolved

function x = norms_Math(A)
 home
 if nargin == 0
     A = [ 1 2 3; 4 9 6; 0 -5 120];
 end
    
[m,n] = size(A);
if m > 1 & n> 1
    flag = 0;
    fprintf('exoume pinaka !\n')
else
    flag = 1;
    fprintf('exoume dianisma !\n')
end

if flag == 1
    
    x1 = norm(A,1);
    x2  = norm(A,2);
    xinf = norm(A,Inf);
    
    fprintf(' h proti norma tou dianismatos A isoutai me %f \n' , x1)
    fprintf(' h deyteri norma tou dianismatos A isoutai me %f \n' , x2)
    fprintf(' h apeirosti norma tou dianismatos A isoutai me %f \n' , xinf)
    
    x = [x1 x2 xinf];

else
    x = [];
    for i = 1:n
        
        disp(A(:,i)) %emfanizo thn trexousa stili toy A
        
        x1 = norm(A(:,i),1);
        x2  = norm(A(:,i),2);
        xinf = norm(A(:,i),Inf);
        
        fprintf()
        fprintf()
        fprintf()
        fprintf('\n')
        
     x = ? ;   
    end
end

% gemiste ton parapano kodika oste na emfanizontai ta parakato minimata otan kaleitai ti sinartisi xoris orisma, diladi x = norms_Math() 
% exoume pinaka !
%      1
%      4
%      0
% 
%  h proti norma ths 1 sthlhs toy pinaka A isoutai me 5.000000 
%  h deyteri norma ths 1 sthlhs toy pinaka A isoutai me 4.123106 
%  h apeirosti norma ths 1 sthlhs toy pinaka A isoutai me 4.000000 
% 
%      2
%      9
%     -5
% 
%  h proti norma ths 2 sthlhs toy pinaka A isoutai me 16.000000 
%  h deyteri norma ths 2 sthlhs toy pinaka A isoutai me 10.488088 
%  h apeirosti norma ths 2 sthlhs toy pinaka A isoutai me 9.000000 
% 
%      3
%      6
%    120
% 
%  h proti norma ths 3 sthlhs toy pinaka A isoutai me 129.000000 
%  h deyteri norma ths 3 sthlhs toy pinaka A isoutai me 120.187354 
%  h apeirosti norma ths 3 sthlhs toy pinaka A isoutai me 120.000000 
% 
% 
% x =
% 
%     5.0000    4.1231    4.0000
%    16.0000   10.4881    9.0000
%   129.0000  120.1874  120.0000

 

Posted in Uncategorized