Edit & Create 2. Observe the 2 link planar robot shown below with link lengths a
ID: 3752811 • Letter: E
Question
Edit & Create 2. Observe the 2 link planar robot shown below with link lengths a, 30 and a -20. With MATLAB, show that the joint velocities approach infinity under the following conditions: a. The initial (x, y) values of the end-effector are (12, 10). b. The end-effecter moves along a path in the direction of the vectori+2 c. The total velocity of the end-effecter is constant: v,- 2 cm/s;v,-4 cm/s. Hand in this page, your MATLAB code, any work done by hand, and a single page of 4 plots (2 rows, 2 columns). The four plots are: 1. A subplot of the (x, v) coordinates of the end-effector until the manipulator arrives at the boundary of its workspace. Pot y vs. x. 2. A subplot of the joint angles 8, and 82 vs. time 3. A subplot of the rate of 8, vs. time 4. A subplot of the rate of 8, vs time Be sure that all plots are appropriately titled and all axes are labeled. Use the legend command where appropriate. "elbow up" or "elbow down" solution. Print your name in the title of the first plot. Indicate on one of the plots whether you chose the 0, az asExplanation / Answer
There are basically 2 ways of writing a matlab code. First there is a function and then there is a script. Functions takes variable while calling it, while the script doesn't take in any inputs while running. Script is essentially a bunch of lines which are exactly as when you execute code line by line on the main page matlab. So first you need to decide what do you want to write a script or a function. While in a script you can still take input by using the in-built function input() but you can take inputs as command line arguments if you are familiar with any other programming languages. Scripts also store your environment(your variables you declare in the script) but function discards them once the function has executed. You can also not return any data in scripts but can in functions.
There is a certain way of starting a function file. The function name and the file name must be exactly the same. If you are saving the file with the name a.m then it will be:
function [output1, output2,...] = a(input1, input2...)
If there is only one output you can omit the [].
Scripts are started by just saving the file with a name.m and start writing what you want to do. It is plain basic code that will be executed line by line.
You can take input by the inbuilt function of input(). Then you have to parse to different data types depending on your needs.
I hope this helps you in starting your matlab functions and scripts. For any further questions do comment or refer to the matlab official documentation on mathworks.com. Official documents are a little difficult but often the best place to start.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.