i literally need the code for this or a script to run for it
i literally need the code for this, or a script to run for it.
ndow Hel ENGR 112 Lab4 Tools ENGR112 Lab4 F... 78.6% y y(0.2) just after you declare your y function what happens? Why? Week 4 ENGR 112 In lab exercise Comment out that line so your script works again Self-check: Same as problem 1 3) Create a function that calculates a circle, then write a script to create and plot several circles using that function. Do either the simple version or the extra credit version; you don\'t need to turn in both. Write a function that takes in a theta and radius r value and returns the corresponding point on a circle This function should return Two values,x and y o function [x yl- MakeCircle(r, theta) r cos(theta) sin(theta) Use this function to plot 3 concentric circles [Extra credit] Use a for loop and an array variable to declare the r values so that you can, eg, change the number of circles by changing the number of elements in the vector. Your for loop should operate on that vector. Note: Use plot for this problem, not fplot. Use axis equal to make the circles look like circles. Self-check. (Extra credit on right)Solution
function [x,y] =MakeCircle(r,theta)
x=r*cos(theta)
y=r*sin(theta)
plot(x,y)
end
for r=1:6
MakeCircle(r,pi/4)
end
The above give script will create 6 concentric circles with center (0,0)
explaination:
Here the function takes the input polar coordinates and then we calculate the x and y values by using the given formula which includes +xc and +yc whose values are 0,0 since the center is at origin and then we plot the circle for the calculated x and y values using the plot() function available in matlab..
