# L2 norm of the column

12 ビュー (過去 30 日間)
Heya :) 2020 年 4 月 2 日
コメント済み: Torsten 2020 年 4 月 2 日
How can I write the code to find the L2 norm of the column (G`)ij as shown in the picture below. In my code I have used M instead of G.
clear all; close all; clc;
x(1)=0;
y(1)=0;
a=1.2;
b=0.3;
for i=2:10000
x(i)=1-1.4*(x(i-1)^2)+y(i-1);
y(i)=b*x(i-1);
end
%plot(x,y,'.','MarkerSize',2)
%hold on
%xlabel('x')
%ylabel('y')
%title('henon map')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X=x(2:21);
Y=y(2:21);
M=zeros([20,10]);
for i=1:20
for j=1:16
if j==1
M(i,j)=1;
elseif j==2
M(i,j)=x(i);
elseif j==3
M(i,j)=y(i);
elseif j==4
M(i,j)=x(i)*y(i);
elseif j==5
M(i,j)=x(i)^2;
elseif j==6
M(i,j)=y(i)^2;
elseif j==7
M(i,j)=x(i)^2*y(i)^2;
elseif j==8
M(i,j)=x(i)^2*y(i);
elseif j==9
M(i,j)=x(i)*y(i)^2;
elseif j==10
M(i,j)=x(i)^3;
elseif j==11
M(i,j)=y(i)^3;
elseif j==12
M(i,j)=x(i)^3*y(i);
elseif j==13
M(i,j)=x(i)*y(i)^3;
elseif j==14
M(i,j)=x(i)^3*y(i)^2;
elseif j==15
M(i,j)=x(i)^2*y(i)^3;
else
M(i,j)=x(i)^3*y(i)^3;
end
end
end
X=X';

### 採用された回答

Torsten 2020 年 4 月 2 日
M_norm = normc(M)

#### 6 件のコメント

Torsten 2020 年 4 月 2 日
Please include code and error message.
Heya :) 2020 年 4 月 2 日
clear all; close all; clc;
x(1)=0;
y(1)=0;
a=1.2;
b=0.3;
for i=2:10000
x(i)=1-1.4*(x(i-1)^2)+y(i-1);
y(i)=b*x(i-1);
end
%plot(x,y,'.','MarkerSize',2)
%hold on
%xlabel('x')
%ylabel('y')
%title('henon map')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X=x(2:21);
Y=y(2:21);
M=zeros([20,10]);
for i=1:20
for j=1:16
if j==1
M(i,j)=1;
elseif j==2
M(i,j)=x(i);
elseif j==3
M(i,j)=y(i);
elseif j==4
M(i,j)=x(i)*y(i);
elseif j==5
M(i,j)=x(i)^2;
elseif j==6
M(i,j)=y(i)^2;
elseif j==7
M(i,j)=x(i)^2*y(i)^2;
elseif j==8
M(i,j)=x(i)^2*y(i);
elseif j==9
M(i,j)=x(i)*y(i)^2;
elseif j==10
M(i,j)=x(i)^3;
elseif j==11
M(i,j)=y(i)^3;
elseif j==12
M(i,j)=x(i)^3*y(i);
elseif j==13
M(i,j)=x(i)*y(i)^3;
elseif j==14
M(i,j)=x(i)^3*y(i)^2;
elseif j==15
M(i,j)=x(i)^2*y(i)^3;
else
M(i,j)=x(i)^3*y(i)^3;
end
end
end
X=X';
M_norm = normc(M (i,j)) % [This is the L2 norm]
G=x(i)[First element of the column] /M_norm [L2 norm].
Torsten 2020 年 4 月 2 日
If G is the matrix you want to normalize, then G' = normc(G).
I think that G=M in your code, but I'm not sure.