Question: The goal of this exercise is to plot the function r()- where is a phase angle and r(0) is the radius at that angle, over

The goal of this exercise is to plot the function r()- where is a phase angle and r(0) is the radius at that angle, over the range 2 It is often useful to define a function to handle calculations that will be performed over and over again. Designing your code this way presents several advantages: Individual functions that perform specific tasks can be built and tested separately from the rest of the code. This not only can make your program easier to debug, it breaks the programming taslk down into smaller, more manageable chunks that can potentially be shared among multiple coders Functions can be used by more than one program - so if you've written a function that does something useful, you can reuse it if you need to perform the same task in another program We will write a simple program that plots the above function using a main program and a function. In teams of two, decide which person will take the lead on the function and which person will take the lead on the main program The FUNCTION should take as input the phase angle and return as output the Cartesian (x,y) coordinates corresponding to the point (,r(9) (defined as above). Recall that the following functions can be used to convert polar coordinates to Cartesian coordinates: y-r sin(0) For help with the syntax for functions in MATLAB, type help function on the command line in MATLAB. The MAIN PROGRAM should use a loop to pass phase angles one-at-a-time to the function over the range of inputs, collect the outputs, and then plot the results. For help with the syntax of loops in MATLAB (and to help consider what kind of loop would be appropriate here), use the MATLAB help to find out more about the following: for if while
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
