How do I draw the same graph as the picture?
1 view (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
KSSV
on 10 May 2021
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 Comments
KSSV
on 10 May 2021
plot3(x1,x2,v,'.r') ;
hold on
plot3(X,Y,V,'.b') ;
legend('original','interpolated')
More Answers (0)
See Also
Categories
Find more on Graph and Network Algorithms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!