필터 지우기
필터 지우기

I want to improve the mesh of my graph ?

조회 수: 2 (최근 30일)
merwan behar
merwan behar 2023년 3월 26일
댓글: Mathieu NOE 2023년 3월 28일
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)');

채택된 답변

Mathieu NOE
Mathieu NOE 2023년 3월 27일
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
merwan behar
merwan behar 2023년 3월 27일
Thank you very much, you are very professional
Mathieu NOE
Mathieu NOE 2023년 3월 28일
my pleasure !
do you mind accepting my answer ? thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by