The link below is the MATLAB Exercise 2.1: http://www.chegg.com/homework-help/ve
ID: 3587485 • Letter: T
Question
The link below is the MATLAB Exercise 2.1:
http://www.chegg.com/homework-help/vector-magnitude-using-matlab-write-function-vectormag-calcu-chapter-2-problem-1ME-solution-9780132857949-exc
GUI for different coordinate conversions. Create a graphical user interface (GUI) in MATLAB that combines the functions for different coordinate conversions written in the previous MATLAB exercise, as well as the corresponding functions to convert cylindrical to spherical coordinates of a point and vice versa [functions cyl2Sph) and sph2Cylol The user should be able to specify the type of conversion, enter input data, and run the function, upon which the program displays results. All angles at input and output are in degrees. [folder ME1 25(GUI) on IR HINT: Build an interface - using the existing MATLAB GUI. See MATLAB Exercise 2.1 (in the next chapter) -for the GUl development.Explanation / Answer
i used RBBOX technique and use the currentpoint property of the axes
figure;
pcolor(peaks);
k = waitforbuttonpress;
point1 = get(gca,'CR'); % button down detected
finalRect = rbbox; % return figure units
point2 = get(gca,'CP'); % button up detected
point1 = point1(1,1:2); % extract x and y
point2 = point2(1,1:2);
p1 = min(point1,point2); % calculate locations
offset = abs(point1-point2); % and dimensions
x = [p1(1) p1(1)+offset(1) p1(1)+offset(1) p1(1) p1(1)];
y = [p1(2) p1(2) p1(2)+offset(2) p1(2)+offset(2) p1(2)];
hold on
axis manual
plot(x,y,'r','linewidth',5) % draw box around selected region
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.