Enable contrast version

Tutor profile: Crystalynne C.

Inactive
Crystalynne C.
Assistant Professor for 11 years
Tutor Satisfaction Guarantee

Questions

Subject: MATLAB

TutorMe
Question:

Create a Matlab code for the forward kinematics of a two-link revolute joint manipulator when q1 = [20 30 10 15] and q2 = [23 45 20 21]. Both q1 and q2 are in degrees angle. Use 200mm and 500 mm as lengths of links 1 and 2 respectively.

Inactive
Crystalynne C.
Answer:

clc %clear all line in the command window clear all %clear all previous saved values close all %close all opened plots q1 = [20 30 10 15] .* pi/180; %convert q1 to radians q2 = [23 45 20 21].* pi/180; %convert q2 to radians ef = [0 0 0 1]'; %end effector matrix len = [200 500]; %link lengths for i=1:4 %loop for the values of q1 and q2 %compute for the transformation matrix A10 A10 = [cos(q1(i)) -1*sin(q1(i)) 0 len(1)*cos(q1(i)); sin(q1(i)) cos(q1(i)) 0 len(1)*sin(q1(i)); 0 0 1 0; 0 0 0 1]; %compute for the transformation matrix A10 A21 = [cos(q2(i)) -1*sin(q2(i)) 0 len(2)*cos(q2(i)); sin(q2(i)) cos(q2(i)) 0 len(2)*sin(q2(i)); 0 0 1 0; 0 0 0 1]; %compute for the position pos = A10 * A21 * ef; %this is the formula for the forward kinematics x(i) = pos(1); %get value of x y(i) = pos(2); %get value of y z(i) = pos(z); %get value of z end %display the positions x, y and z x y z

Subject: C++ Programming

TutorMe
Question:

Write a C++ program that will accept two integers and will ask the user on what mathematical operation (multiplication, division, addition and subtraction) to use and implement.

Inactive
Crystalynne C.
Answer:

#include <iostream> using namespace std; int x, y; //Variables for the two input integers int sum, diff, prod; //Variables for the sum, difference and product set as integer data type double quo; //Variables for the quotient set as double data type int ch; //Variables for choice set as integer data type int main() { cout << "Input first integer : "; cin >> x; cout << "Input first integer : "; cin >> y; cout << "Choose the Number of the Mathematical Operation to Use" << endl; cout << "[1] Multiplication" << endl; cout << "[2] Division" << endl; cout << "[3] Addition" << endl; cout << "[4] Subtraction" << endl; cout << "Choice : " ; cin >> ch; if(ch==1) { prod = x*y; cout << "The product of " << x << " and " << y << " is "<< prod <<"." << endl; } if(ch==2) { quo = double(x)/double(y); //This will convert the quotient from integer to double cout << "The quotient of " << x << " and " << y << " is "<< quo <<"." << endl; } if(ch==3) { sum = x+y; cout << "The sum of " << x << " and " << y << " is "<< sum <<"." << endl; } if(ch==4) { diff = x-y; cout << "The difference of " << x << " and " << y << " is "<< diff << "." << endl; } return 0; }

Subject: Arduino Programming

TutorMe
Question:

Using piezo-electric buzzer and push buttons, create an Arduino code for a mini piano. Use Arduino Mega 2560.

Inactive
Crystalynne C.
Answer:

void setup() { //Assign analog pins of Aduino Mega 2560 to buttons. pinMode(A0, INPUT); //button for do pinMode(A1, INPUT); //button for re pinMode(A2, INPUT); //button for mi pinMode(A3, INPUT); //button for fa pinMode(A4, INPUT); //button for so pinMode(A5, INPUT); //button for la pinMode(A6, INPUT); //button for ti pinMode(A7, INPUT); //button for do //Assign digital pin 12 for piezo-electric buzzer. pinMode(12, OUTPUT); } void loop() { // if button on A0 is pressed if (digitalRead(A0) == HIGH) { tone(12, 261, 100); // play tone (C4 = 261 Hz) } // if button on A1 is pressed if (digitalRead(A1) == HIGH) { tone(12, 293, 100); // play tone (B4 = 293 Hz) } // if button on A2 is pressed if (digitalRead(A2) == HIGH) { tone(12, 329, 100); // play tone (E4 = 329 Hz) } // if button on A3 is pressed if (digitalRead(A3) == HIGH) { tone(12, 349, 100); // play tone (F4 = 349 Hz) } // if button on A4 is pressed if (digitalRead(A4) == HIGH) { tone(12, 392, 100); // play tone (G4 = 392 Hz) } // if button on A5 is pressed if (digitalRead(A5) == HIGH) { tone(12, 440, 100); // play tone (A4 = 440 Hz) } // if button on A6 is pressed if (digitalRead(A6) == HIGH) { tone(12, 494, 100); // play tone (B4 = 494 Hz) } // if button on A7 is pressed if (digitalRead(A7) == HIGH) { tone(12, 523, 100); // play tone (A4 = 523 Hz) } delay(20); // Delay before tone plays after the button is pressed }

Contact tutor

Send a message explaining your
needs and Crystalynne will reply soon.
Contact Crystalynne

Request lesson

Ready now? Request a lesson.
Start Lesson

FAQs

What is a lesson?
A lesson is virtual lesson space on our platform where you and a tutor can communicate. You'll have the option to communicate using video/audio as well as text chat. You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.
How do I begin a lesson?
If the tutor is currently online, you can click the "Start Lesson" button above. If they are offline, you can always send them a message to schedule a lesson.
Who are TutorMe tutors?
Many of our tutors are current college students or recent graduates of top-tier universities like MIT, Harvard and USC. TutorMe has thousands of top-quality tutors available to work with you.
BEST IN CLASS SINCE 2015
TutorMe homepage
Made in California by Zovio
© 2013 - 2021 TutorMe, LLC
High Contrast Mode
On
Off