Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
dayeon
dayeon le 9 Mar 2024
Commenté : Voss le 5 Avr 2024
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 :))

Réponse acceptée

Voss
Voss le 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')
  2 commentaires
dayeon
dayeon le 5 Avr 2024
thank you so much! It really helped me!! :))
Voss
Voss le 5 Avr 2024
You're welcome!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by