Skip to main content
Logo image

Section 8.10 Practice Your Functions

Activity 8.3.

Write a user-defined function circleplot(x,y,R) that plots a circle with center \((x,y)\) and radius \(R\text{.}\) Choose your axes such that the origin is visible within your plot and also so that the circle looks round (and not oval).
This function has no output parameters.
Please paste one solution per group into the textbox.

Activity 8.4.

Write a user-defined function myprimes(m,n) that returns all prime numbers between the two input arguments \(m\) and \(n\text{.}\) The output argument should be a vector with the prime numbers. If the function is called with \(m > n\) an error message should be displayed. If a negative number or a non-integer number is entered, an error message should be displayed as well.
Please paste one solution per group into the textbox.

Activity 8.5.

Write a user-defined function CartToPolar(x,y) that converts the Cartesian coordinates \((x,y)\) to polar coordinates \((r, \theta)\text{.}\)
The function name and arguments should thus be
[r, theta] = CartToPolar(x,y)
Please paste one solution per group into the textbox.