How do I draw the same graph as the picture?

조회 수: 1 (최근 30일)
민제 강
민제 강 2021년 5월 10일
댓글: KSSV 2021년 5월 10일
x1 = [4.158236141 6.153599506 -4.535940798 7.598349019 1.546377884 -1.345068203 9.996482015 -0.173832303 -4.963945249 7.601915038 6.858088405 6.026235301 3.704288407 3.26674903 3.077538527 3.32612663 3.171101989 9.937861391 9.863387191 -4.925131257];
x2 = [2.015908909 12.95555116 11.95848613 6.917196588 9.949209037 2.568895989 0.600398657 14.98330222 6.845564827 3.014910507 0.181581313 2.019090607 2.012738027 2.016006495 0 5.08610712 2.193143018 10.52404152 14.64506378 0.388181645];
v = [5.107328283 160.1220683 23.67014797 43.25143692 47.46188065 45.85372988 7.680346552 95.19501237 117.2067804 15.11163604 19.01778002 20.13095512 1.896743409 0.499697271 5.825451311 9.267063133 0.405543669 59.12461059 139.9629599 287.0573273];
F = scatteredInterpolant(x1',x2',v') ;
xi = 2.2 ;
yi = 7.2;
vi = F(xi,yi)
please let me know.

채택된 답변

KSSV
KSSV 2021년 5월 10일
x1 = [4.158236141 6.153599506 -4.535940798 7.598349019 1.546377884 -1.345068203 9.996482015 -0.173832303 -4.963945249 7.601915038 6.858088405 6.026235301 3.704288407 3.26674903 3.077538527 3.32612663 3.171101989 9.937861391 9.863387191 -4.925131257];
x2 = [2.015908909 12.95555116 11.95848613 6.917196588 9.949209037 2.568895989 0.600398657 14.98330222 6.845564827 3.014910507 0.181581313 2.019090607 2.012738027 2.016006495 0 5.08610712 2.193143018 10.52404152 14.64506378 0.388181645];
v = [5.107328283 160.1220683 23.67014797 43.25143692 47.46188065 45.85372988 7.680346552 95.19501237 117.2067804 15.11163604 19.01778002 20.13095512 1.896743409 0.499697271 5.825451311 9.267063133 0.405543669 59.12461059 139.9629599 287.0573273];
F = scatteredInterpolant(x1',x2',v') ;
m = 500 ; n = 500 ;
xi = linspace(min(x1),max(x1),m) ;
yi = linspace(min(x2),max(x2),n) ;
[X,Y] = meshgrid(xi,yi) ;
V = F(X,Y) ;
contourf(X,Y,V)
  댓글 수: 2
민제 강
민제 강 2021년 5월 10일
Thank you so much. I have one more question, how do I plot the values of x1,x2,v on the graph? And can I use plot3(X,Y,Z) to do it in 3D?
KSSV
KSSV 2021년 5월 10일
plot3(x1,x2,v,'.r') ;
hold on
plot3(X,Y,V,'.b') ;
legend('original','interpolated')

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by