Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program using Matlab for Bug-0 (Robot): robot goes towards the goal. Whe

ID: 3881471 • Letter: W

Question

Write a program using Matlab for Bug-0 (Robot): robot goes towards the goal. When it has faced with an obstacle follow the obstacle until the way to the goal is revealed. The algorithm is terminated when the goal is reached.

There are several obstacles but here are two of them:

1.obstacle1.txt:

1
4
-8.052000 -6.720000
4.576000 7.933333
1.408000 8.353333
-11.000000 -5.040000
3 1 2
3 0 1

2. obstacle2.txt:

3

12
-8.140000 7.980000
-11.000000 6.953333
-12.320000 5.273333
-12.188000 3.406667
-11.088000 1.773333
-9.020000 1.120000
-7.304000 1.400000
-5.588000 2.286667
-4.224000 3.546667
-3.520000 5.413333
-4.312000 7.933333
-6.380000 8.586666

18
-9.108000 -9.613333
-8.888000 -10.593333
-7.612000 -10.686666
-5.500000 -9.566666
-3.124000 -7.420000
-0.088000 -4.106666
1.804000 -0.606667
3.256000 3.500000
4.268000 7.233333
5.148000 8.026666
5.148000 8.820000
4.488000 9.006666
2.728000 8.120000
1.188000 4.666666
0.484000 0.606667
-1.408000 -2.753333
-4.312000 -5.880000
-7.612000 -8.960000

6
7.832000 -0.980000
5.236000 -8.540000
9.988000 -10.500000
11.572000 -9.426666
7.524000 -7.793333
9.636000 -1.306667

Edit: The numbers in the .txt files are obstacles that are given for this project (check image below). The robot needs to run successfully for every different obstacle. For more information and to get access to the obstacles' files please check (Project1: Bug Algorithms) http://www.robotmotionplanning.org/TeachingRobotics.html#Project1Bug

obstacle1.txt obstacle2.txt

Explanation / Answer

num = input('Enter a number: '); p = 0; %even im = 0; %odd pos = 0; %positives n = 0; %negatives for x = 1; x 0 pos = pos + 1; else n = n + 1; end end end disp('the even numbers are'); disp(p); disp('the odd numbers are') disp(im); disp('the positive numbers are') disp(pos); disp('the negative numbers are') disp(n);
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote