For Loop maximum graph
Mostrar comentarios más antiguos
given a matrix C, i am to find the values of x and y where the plot of C is at max. whenever i run a code that uses the find function, i am returned with the row and column of the element in the matrix instead, and not the x and y points of the graph. any idea how to fix this?
1 comentario
Davide Masiello
el 8 de Abr. de 2022
Could you please share your code?
Respuestas (1)
Idk why membrane doesn't allow for the x,y data to be an output argument, but it doesn't. You can just create them anyway.
m = 15; % this is the default
xy = linspace(-1,1,2*m+1);
C = membrane(1,m);
[mxz, idx] = max(C(:));
[r, c] = find(C == mxz);
maxpoints = [xy(c) xy(r) mxz] % [x y z]
surf(xy,xy,C); hold on;
plot3(maxpoints(1),maxpoints(2),maxpoints(3),'ko','markersize',15)
Categorías
Más información sobre Graphics Object Properties en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
