Write a MATLAB function M-file named ResVec to computee the resultant of two vec
ID: 646008 • Letter: W
Question
Write a MATLAB function M-file named ResVec to computee the resultant of two vectors. Each of these vectors is a separate input to the function. They are in Polar form, magnitude and angle, in degrees. The output vector is also in polar form. The output angle must always be positive, measured from the positive x-axis. The input angles may be negative.
Example:
>> vec1 = [1 0];
>> vec2 = [1 90];
>> vecR = ResVec(vec1,vec2)
VecR =
1.4142 45.000
Code Restrictions- You may not use built - in functions to convert coordinates between polar and Cartesian form. You may not use atan2 or atan2d.
Input Restrictions: The function should return a red error message for the following conditions. 1.) Not having both a magnitude and angle in the input arguments 2.) The input angles must be between -360 and 360
Explanation / Answer
a = [2 3 5]; b = [1 1 0]; c = a+b; starts = zeros(3,3); ends = [a;b;c]; quiver3(starts(:,1), starts(:,2), starts(:,3), ends(:,1), ends(:,2), ends(:,3)) axis equal
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.