Commit 6d027f20 authored by Conor McCoid's avatar Conor McCoid
Browse files

ASPN: added secant method to 1Dsin_v1 example

parent 18606ca8
......@@ -23,4 +23,21 @@ xlabel('\gamma')
ylabel('G(\gamma)')
legend('G(\gamma)','NR')
set(gca,'linewidth',2,'fontsize',26)
%==Secant method==%
S=zeros(length(yy));
for i=1:length(yy)
for j=1:length(yy)
S(i,j) = yy(i) - (G(i) - yy(i))*(yy(i) - yy(j))/(G(i)-G(j) + yy(j) - yy(i));
S(i,j) = S(i,j)/abs(yy(i));
end
end
figure(2)
contourf(yy,yy,S,-1:1)
axis([-L,L,-L,L])
axis square
xlabel('x_n')
ylabel('x_{n-1}')
title('Secant method applied to altS')
set(gca,'linewidth',2,'fontsize',26)
end
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment