Plot progress of an algorithm over contour lines in MATLAB

112 Views Asked by At

I'm attempting to generate a figure similar to the following image from Vandenberghe: enter image description here

Is there any way to do so in MATLAB?

So far, here is the code I have

% Code to replicate example from Vandenberghe
ggamma = 10;

x = zeros(100, 2);
x(1, :) = [ggamma, 1];

for i = 2:length(x)`
    x(i, 1) = ggamma*((ggamma - 1)./(ggamma + 1))^i;
    x(i, 2) = (-1*(ggamma - 1)./(ggamma + 1))^i;
end

syms x1 x2
fcontour(.5*(x1.^2 + 10.*x2.^2), [-10 10 -4 4])

So essentially, I want to plot the values of the x vector over the figure generated by fcontour.

1

There are 1 best solutions below

1
On BEST ANSWER
hold on
plot(x(:,1),x(:,2))
plot(x(:,1),x(:,2),'o')

not really a mathematics question though...