Change the location of points in a 2D meshgrid

조회 수: 1 (최근 30일)
Ilias Minas
Ilias Minas 2022년 5월 18일
답변: Matt J 2022년 5월 18일
Hi everyone,
I have created the grid which have the points shown in the picture. I used meshgrid in order to create this
Each point is placed according to a vector called 'location'. In this vector the values of x, y are described for each point.
the values for x are between -5,5 and for y the same
I want to change the location of each point, from 0.2-0.5 randomly.
How can I do this?
you can see below a screenshot of the 'location' vector.
For example I want the point -4.2,-5 to become -4.5,5.2
Thank you very much

채택된 답변

Matt J
Matt J 2022년 5월 18일
location=location+rand(size(location))*0.3+0.2;

추가 답변 (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