gcd1.m

来自「基于OFDM的无线宽带系统仿真It contains mainly two pa」· M 代码 · 共 26 行

M
26
字号
function res = gcd1(a)% DESCRIPTION res = gcd1(a)%  Greatest common divisor for each column of any non empty matrix%  with integer values. % INPUT%  a --    Any non integer matrix.% OUTPUT%  res --  A vector with one element for each column,%          containing the greatest common divisor for that column.% TRY%  gcd1([5; 30]) or gcd1([2*3*4 3*5 2*3]')% SEE ALSO%  gcd % by Magnus Almgren 991101if isempty(a) res = a;% break returnendr = a(1,:); for i = 1:size(a,1); r = gcd(r,a(i,:));endres = reshape(r,size(a(1,:)));  

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?