I want to improve the mesh of my graph ?

1 visualización (últimos 30 días)
merwan behar
merwan behar el 26 de Mzo. de 2023
Comentada: Mathieu NOE el 28 de Mzo. de 2023
I want to increase the mesh of my graph so that it is clear and explanatory and I cannot use the interp2 function.
my code:
clear
clc
x=-(0:0.05:0.2);
y=0:0.5:2;
Z=[20.5896 20.7032 21.0404 21.5908 22.3385;21.1888 21.2992 21.6272 22.1630 22.8920;.......
21.7715 21.8790 22.1984 22.7208 23.4325;22.3391 22.4439 22.7553 23.2652 23.9607;....
22.8926 22.9948 23.2989 23.7971 24.4775];
[X,Y] = meshgrid(y,x);
surf(X,Y,Z)
title ('(d)')
xlabel('l (nm)');
ylabel('V0 (volt)');
zlabel('{\omega} (GHz)');

Respuesta aceptada

Mathieu NOE
Mathieu NOE el 27 de Mzo. de 2023
hello
sure you can use interp2
see example below
I opted for spline method for a smoother surface rendering
clear
clc
x=-(0:0.05:0.2);
y=0:0.5:2;
Z=[20.5896 20.7032 21.0404 21.5908 22.3385;21.1888 21.2992 21.6272 22.1630 22.8920;.......
21.7715 21.8790 22.1984 22.7208 23.4325;22.3391 22.4439 22.7553 23.2652 23.9607;....
22.8926 22.9948 23.2989 23.7971 24.4775];
[X,Y] = meshgrid(y,x);
figure(1),
subplot(2,1,1),surf(X,Y,Z)
title ('(d)')
xlabel('l (nm)');
ylabel('V0 (volt)');
zlabel('{\omega} (GHz)')
% refined mesh plot
N = 10; % upsampling factor
dx = mean(diff(x));
xi=x(1):dx/N:x(end);
dy = mean(diff(y));
xi=x(1):dx/N:x(end);
yi=y(1):dy/N:y(end);
[Xi,Yi] = meshgrid(yi,xi);
Zi = interp2(X,Y,Z,Xi,Yi,'spline');
subplot(2,1,2),
surf(Xi,Yi,Zi)
title ('(d)')
xlabel('l (nm)');
ylabel('V0 (volt)');
zlabel('{\omega} (GHz)');
  2 comentarios
merwan behar
merwan behar el 27 de Mzo. de 2023
Thank you very much, you are very professional
Mathieu NOE
Mathieu NOE el 28 de Mzo. de 2023
my pleasure !
do you mind accepting my answer ? thanks

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by