help me....matlab very difficult...

2 Ansichten (letzte 30 Tage)
jongju an
jongju an am 21 Apr. 2018
Kommentiert: Walter Roberson am 21 Apr. 2018
hello hi i'm korean student.. I want to do a spray drones simulation through MATLAB. I do not know how to represent a map when I want to represent cropland on MATLAB (ex. 100 * 100 ...) And if you pass that part in the original form, you try to express it by adding one cell to +1. This is a difficult situation because there is no example.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 21 Apr. 2018
Create a 100 by 100 numeric matrix, M. Put -1 into the locations that are not cropland.
As you simulate the flying drone, if you are at location (J, K) test M(J, K) >= 0 & M(J, K) < maximum spray. If the test is satisfied then M(J, K) =M(J, K) +1 and reduce the amount of chemical stored on the drone.
Also at each step reduce the stored fuel by an amount that depends on the remaining amount of chemical, because fuel consumption decreases as the drone gets lighter.
This does not assume that each location is to be sprayed only once but it does assume that there is a maximum amount to spray for any location.
  4 Kommentare
jongju an
jongju an am 21 Apr. 2018
Thank you so much. I wonder that the spraying range is scattered widely in elliptical form. We have to +1 the part of the range in the matrix. Drone is move in this way [1,1]> [2,1]> [3,1]........[n,n] (ㄹ form) So I'm wondering about the code that increases the elements of a matrix that belongs to an ellipse. You are really helping me.
Walter Roberson
Walter Roberson am 21 Apr. 2018

The position moved to is controlled by the lines

I = min(max(I + randi([-1 1]), 1),N);
J = min(max(J + randi([-1 1]), 1),N);

At present this is done by moving to a random adjacent location (it can also end up staying in the same place, especially if it would go outside of the map.) You can change the code to follow any pattern you want.

You will need to enhance the simulation by having the drone notice when it is getting low on fuel and having it fly back for refueling.

Then, once it refuels, if it just flies the same pattern again then it will run out of fuel even sooner (because it will be dropping less spray on the places that already have enough, so it will be flying heavier than on the original pass.)

So your code should be doing path planning.

Simple example: when the drone is getting low on fuel, then flying directly back might take it back over places that have already been sprayed enough. But if the drone moves over to the next row or column and follows that back, perhaps it will encounter fewer places that have already been done. On the other hand, if the drone runs out of spray then it should fly the most fuel-efficient route back to refill. This should be part of your calculations, not just choosing a good "starting" point but also how it is eventually going to get back.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by