Clear Filters
Clear Filters

how to draw contour error graph by using vector-like formation data

2 views (last 30 days)
hi, i want to plot following graph by using 'contour' function in matlab.
here, i want to plot the cyclic coordinate optimizer's performance, which is used in align two images, shifting to x and y direction.
so in upper image, x is the x shift value, and y is y shift value, and z is error value.
and my x, y, z data is vector formation, so i don't know how to use matlab's 'contour' function by using these data.
how can i plot upper graph by using my vector data?
i appreciate all your help.
thanks a lot :))

Accepted Answer

Voss
Voss on 9 Mar 2024
% plot the contour
f = @(x,y)5*x.^2-6*x.*y+5*y.^2;
[X,Y] = meshgrid(linspace(-1.5,1.5,100));
contour(X,Y,f(X,Y),linspace(0.5,5,6),'k','ShowText','on')
% I don't know what form your x,y is in, so I use this
xy0 = [-0.5 -1];
dxy = [0 0.6; 0.25 0; 0 0.2; 0.15 0; 0 0.15; 0.05 0; 0 0.03; 0.03 0; 0 0.02; 0.02 0];
xy = xy0+[0 0; cumsum(dxy,1)];
% plot the red line from x,y
hold on
plot(xy(:,1),xy(:,2),'r')

More Answers (0)

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!