Guest User

Untitled

a guest
Aug 7th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scilab 0.61 KB | None | 0 0
  1. function norma = normaMat(A ,typ)
  2.     [m, n] = size(A);
  3.     B = [];
  4.      
  5.      if(typ == "inf")
  6.          for(i = 1:m)
  7.              s = 0;
  8.              for(j = 1:n)
  9.                  s = s + abs(A(i,j));
  10.                  B(i)=s;
  11.              end
  12.          end
  13.      else if(typ == 1)
  14.              for(i = 1:n)
  15.                  s = 0;
  16.                  for(j = 1:m)
  17.                      s = s + abs(A(j,i));
  18.                      B(i)=s;
  19.                  end
  20.              end
  21.           else
  22.              error("Errore! Valore di norma errato!")
  23.          end
  24.          
  25.      end
  26.      norma = max(B);
  27. endfunction
Add Comment
Please, Sign In to add comment