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

answer asap please. Write a user-defined MATLAB function for the following funct

ID: 3548524 • Letter: A

Question

answer asap please.

Write a user-defined MATLAB function for the following function: r(theta) = 2(1.1 - sin2 theta) The input to the function is theta (in radians) and the output is r. Write the function such that theta can be a vector. Use the function to calculate r(pi/3), and r(3 pi/2). Use the function to plot (polar plot) r(theta) for 0 le theta le 2 pi. The standard form of the equation of a straight line in the x-y plane is: Ax + By + C = 0, and a point in the plane is defined by its coordinates (xo, yo). Write a user-defined MATLAB function that determines the distance between a point and a straight line in the x-y plane. For the function name and arguments use: d = PtoLdist (xo, yo, A, B, C) where the input arguments are the coordinates of the point and the three constants of the equation of the line. The output argument is the distance. Use the function to determine the distance for the following cases: Point: (2, -4), line: -2x + 3.5y - 6 = 0. Point: (11, 2), line: y = -2x + 6, (note that the equation has the slope intercept form).

Explanation / Answer

3)

function r = my_function(theta)

r = 2*(1.1 - (sin(theta))^2);


a = my_function(3*pi/2)

theta = 0:0.1:2*pi;

polar(theta,my_function(theta)


9)

function d = calc_distance(x,y,a,b,c)

d = (ax+by+c)/(sqrt(a^2 + b^2)



a= calc_distance(2,-4,-2,3.5,-6)

b = calc_distance(11,2,-2,-1,6)