Create a function named butterfly. The function receives three input arguments and returns two output variables (x and y values). The function body should also contain a plot command (y as a function of x.
Use loops to plot the butterfly using the equations:
f=e^(cos(t))-2cos(4t)-(sin(t/12))^5x=x0+s*f*sinty=y0+s*f*cost
The three input arguments define the function t: minimum value, maximum value and step size.
The variable s is used to scale the height of the butterfly. It should be defined inside the body of the function as a random real number between 0 and 1 (s is not an input argument for the function).
The variables x0 and y0 define the location of the butterfly center. Ask the user to input their values inside the body of the function.
What I have so far:
function out=butterfly(min,max,n)x0=input('Input the x value of the butterfly center')y0=input('Input the y value of the butterfly center')s=rand(1000,1)x=x0+s*f*sinty=y0+s*f*costplot(x,y)
How do I (1) get the values of x0,y0 to be the center and (2) define t with the values given.
Best Answer