Skip to content

Commit

Permalink
Fix to L2 norm
Browse files Browse the repository at this point in the history
  • Loading branch information
gergelybuza committed Jan 2, 2021
1 parent 26efb8a commit 7187462
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
3 changes: 2 additions & 1 deletion @SSR/FRC.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
N = nan(length(om),1);
for j = 1:length(om)
if ~isempty(cont_sol{j})
N(j) = O.dt*norm(cont_sol{j},'fro');
O.T = 2*pi/om(j);
N(j) = sqrt(O.dt)*norm(cont_sol{j}(1:end/2,:),'fro')/O.T;
end
end
end
4 changes: 2 additions & 2 deletions examples/motiv_example.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@
SSfull.T = 2*pi/Omega_arrayf(j);
[x_lin, xd_lin] = SSfull.LinearResponse();
LinSol = [x_lin; xd_lin];
Nlin(j) = SSfull.dt*norm(LinSol,'fro');
Nlin(j) = sqrt(SSfull.dt)*norm(LinSol(1:end/2,:),'fro')/SSfull.T;
end

figure(2); semilogy(Omega_arrayf,Nf,'-k','DisplayName', 'Full','linewidth',1); axis tight; grid on; hold on;
xlabel('$$\Omega$$ [rad/s]'); ylabel('$$||q||_2$$')
xlabel('$$\Omega$$ [rad/s]'); ylabel('$$\Vert q \Vert_{L^2}/T$$')
legend('show')
semilogy(Omega_arrayf,Nlin,'-b', 'DisplayName', 'Linear','linewidth',1);
semilogy(Omega_array1,N1,'--g', 'DisplayName', 'Reduced $$I_1$$','linewidth',2);
Expand Down
6 changes: 3 additions & 3 deletions examples/vonKarman/example_curvedbeam.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

%% Sequential continuation
omega1 = SSfull.omega(1);
Omega_range = [0.7 1.3]*omega1;
Omega_range = [0.55 1.3]*omega1;
T_range = 2*pi./Omega_range;
ncontsteps = 100;

Expand All @@ -87,11 +87,11 @@
SSfull.T = 2*pi/Omega_arrayf(j);
[x_lin, xd_lin] = SSfull.LinearResponse();
LinSol = [x_lin; xd_lin];
Nlin(j) = SSfull.dt*norm(LinSol,'fro');
Nlin(j) = sqrt(SSfull.dt)*norm(LinSol(1:end/2,:),'fro')/SSfull.T;
end

figure(2); semilogy(Omega_arrayf,Nf,'-k','DisplayName', 'Full','linewidth',1); axis tight; grid on; hold on;
xlabel('$$\Omega$$ [rad/s]'); ylabel('$$||q||_2$$')
xlabel('$$\Omega$$ [rad/s]'); ylabel('$$\Vert q \Vert_{L^2}/T$$')
legend('show')
semilogy(Omega_arrayf,Nlin,'-b', 'DisplayName', 'Linear','linewidth',1);
semilogy(Omega_array1,N1,'--g', 'DisplayName', 'Reduced $$I_1$$','linewidth',2);
Expand Down
12 changes: 6 additions & 6 deletions examples/vonKarman/example_straightbeam.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@
else
[x2,xd2] = SS1.NewtonRaphson('init',x2,'tol',tol,'maxiter',maxiter);
end
N1(j) = SS1.dt*norm([x2; xd2],'fro');
N1(j) = sqrt(SS1.dt)*norm([x2; xd2],'fro');

if j == 1
[x3,xd3] = SS2.NewtonRaphson('tol',tol,'maxiter',maxiter); % find out response using Picard iteration
else
[x3,xd3] = SS2.NewtonRaphson('init',x3,'tol',tol,'maxiter',maxiter);
end
N2(j) = SS2.dt*norm([x3; xd3],'fro');
N2(j) = sqrt(SS2.dt)*norm([x3; xd3],'fro');


if j == 1
Expand All @@ -101,10 +101,10 @@
[xf,xdf] = SS.NewtonRaphson('init',xf,'tol',tol,'maxiter',maxiter);
end

NF(j) = SS.dt*norm([xf; xdf],'fro');
NF(j) = sqrt(SS.dt)*norm([xf; xdf],'fro');

[x_lin, xd_lin] = SS.LinearResponse();
NL(j) = SS.dt*norm([x_lin; xd_lin],'fro');
NL(j) = sqrt(SS.dt)*norm([x_lin; xd_lin],'fro');

disp(vpa(A(j)))
end
Expand All @@ -126,13 +126,13 @@
%% forcing amp - response amp curve
figure
plot(A,NF,'-k','DisplayName', 'Full','linewidth',1); axis tight; hold on;
xlabel('$$F$$ [N]'); ylabel('$$||q||_2$$')
xlabel('$$F$$ [N]'); ylabel('$$\Vert q \Vert_{L^2}$$')
lgd = legend('show');
lgd.Location = 'southeast';
plot(A,NL,'-b', 'DisplayName', 'Linear','linewidth',1);
plot(A,N1,'--g', 'DisplayName', 'Reduced $$I_1$$','linewidth',2);
plot(A,N2,'--r','DisplayName', 'Reduced $$I_2$$','linewidth',2);
ylim([0 0.032])
ylim([0 0.65])



0 comments on commit 7187462

Please sign in to comment.