用rand(n,m)函数生成一个5*5 矩阵A,并且计算它的范数

1个回答

  • To get started,select MATLAB Help or Demos from the Help menu.

    >> A=rand(5,5)

    A =

    0.9501 0.7621 0.6154 0.4057 0.0579

    0.2311 0.4565 0.7919 0.9355 0.3529

    0.6068 0.0185 0.9218 0.9169 0.8132

    0.4860 0.8214 0.7382 0.4103 0.0099

    0.8913 0.4447 0.1763 0.8936 0.1389

    >> s1=abs(A)

    s1 =

    0.9501 0.7621 0.6154 0.4057 0.0579

    0.2311 0.4565 0.7919 0.9355 0.3529

    0.6068 0.0185 0.9218 0.9169 0.8132

    0.4860 0.8214 0.7382 0.4103 0.0099

    0.8913 0.4447 0.1763 0.8936 0.1389

    >> a=A(2,1)

    a =

    0.2311

    >> A(2,3)=5

    A =

    0.9501 0.7621 0.6154 0.4057 0.0579

    0.2311 0.4565 5.0000 0.9355 0.3529

    0.6068 0.0185 0.9218 0.9169 0.8132

    0.4860 0.8214 0.7382 0.4103 0.0099

    0.8913 0.4447 0.1763 0.8936 0.1389

    >> B=sum(A)

    B =

    3.1654 2.5032 7.4517 3.5620 1.3727

    >> max(B)

    ans =

    7.4517