Matlab contour plot with color
Mostrar comentarios más antiguos
Can anyone tell how to plot the contour like this (shown in fig) in MATLAB

Respuestas (2)
Cris LaPierre
el 26 de Mayo de 2021
0 votos
Star Strider
el 26 de Mayo de 2021
0 votos
2 comentarios
mukesh bisht
el 26 de Mayo de 2021
Star Strider
el 26 de Mayo de 2021
It appears that all three of them are vectors, or that error would not appear.
One possibility is that the vectors represent gridded data, so simply using the reshape function with each of them (with the same reshape parameters for each vector) would work. To use it, it would be necessary to know at least one dimension of the matrix (rows or columns). There are several ways to do that, one is using the unique function on either ‘x’ or ‘y’ and determining the number of unique values by the number of elements in the first output.
Alternatively, try something like this —
N = 50;
xv = linspace(min(x), max(x), N);
yv = linspace(min(y), max(y), N);
[X,Y] = ndgrid(xv, yv);
Z = griddata(x, y, z, X, Y);
figure
contourf(X, Y, Z)
colormap('gray')
Change ‘N’ (or use different values for each linspace call), depending on the result you want.
Categorías
Más información sobre Contour Plots 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!