Reputation: 21855
I have the following results :
v =
7.8053 959.5985
6.1820 481.3263
4.9794 242.2347
4.0829 122.7578
3.4079 63.1224
2.8962 33.4578
2.5118 18.8560
2.2380 11.9084
2.0725 8.9597
2.0086 8.0952
2.0001 8.0012
2.0000 8.0000
2.0000 8.0000
Which I got them after I ran a function called newton_system
for calculating , and I ran the input vector [10,3]
on the follwoing f(x,y)
:
y(1) = x(1)^3 - 5*x(1)^4 + x(2)^2 + 8;
y(2) = 2*x(1)^3 - x(2)^2 + 5*x(1)^2 + 5*x(2) - 12;
I ran 13 iterations , and now I want to plot a graph of the approximations as a function of the iterations (from 1 to 13) , can someone please explain how to do that ?
FYI please notice that as I progress with the iterations , we converge to 2.0000 8.0000
Upvotes: 0
Views: 2303
Reputation: 74940
Here's a solution using the plot
command:
plot(v(:,1),v(:,2),'-o') %# plot the line with circles for the x,y values
hold on,plot(2,8,'+r') %# add a red cross for the solution
xlim([0 8]) %# modify x-axes limits so that the plot looks a bit better
Use the zoom button on the figure menu to zoom into the area around the solution.
Upvotes: 1