answer asap please Use MATLAB in the two different ways, described below, to plo
ID: 3548525 • Letter: A
Question
answer asap please
Use MATLAB in the two different ways, described below, to plot the function: Write a program in a script file, using conditional statements and loops. Create a user-defined function for f(x), and then use the function in a script file to make the plot. Write a user-defined function that determines the polar coordinates of a point from the Cartesian coordinates in a two-dimensional plane. For the function name and arguments use [theta radius] = Cartesian To-Polar (x, y). The input arguments are the x and y coordinates of the point, and the output arguments are the angle theta and the radial distance to the point. The angle theta is in degrees and is measured relative to the positive x axis, such that it is a positive number in quadrants I, II, and III, and a negative number in the IV quadrant. Use the function to determine the polar coordinates of points (15,3), (-7,12), (-17,-9), and (10,-6.5).Explanation / Answer
7(a)
x = 2; %%put whatever value of x you want here
if (x>=-6 and x<=-2)
f=4*exp(x+2)
else if (x>=-2 and x<=2)
f=x*x
else if (x>=2 and x<=6)
f=(x+62)^(1/3)
end
7(b)
function f = my_function(x)
if (x>=-6 and x<=-2)
f=4*exp(x+2)
else if (x>=-2 and x<=2)
f=x*x
else if (x>=2 and x<=6)
f=(x+62)^(1/3)
end
18)
function [theta,radius] = cartesianToPolar(x,y)
radius=sqrt(x*x + y*y);
theta=atand(y/x);
%%calling the function
[theta,radius] = cartesianToPolar(15,3)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.