MATLAB Answers

L2 norm of the column

4 views (last 30 days)
Heya :)
Heya :) on 2 Apr 2020
Commented: Torsten on 2 Apr 2020
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';

  0 Comments

Sign in to comment.

Accepted Answer

Torsten
Torsten on 2 Apr 2020
M_norm = normc(M)

  6 Comments

Show 3 older comments
Torsten
Torsten on 2 Apr 2020
Please include code and error message.
Heya :)
Heya :) on 2 Apr 2020
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
Torsten on 2 Apr 2020
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.

Sign in to comment.

More Answers (0)