Example 2: Now suppose we want to plot one period of this periodic sine function: We could try...

60.1K

Verified Solution

Question

Programming

Example 2:
Now suppose we want to plot one period of this periodic sinefunction:

We could try to remember the rules for the shape of sine curvesbased on the general formaty=d+sin(bx+c). This is best,but do you remember? What we can do without havingto remember

is to plot this formula over a few different viewing windowsuntil we can figure it out. Here is an example with comments

Figure 2: Different viewing windows to frame one period of asine function.

>> x=linspace(0,2*pi); plot(x,50+30*sin(2*pi*x/365))          %% [0,2pi] is always a good start, but it is too small. Try a larger domain >> x=linspace(0,100); plot(x,50+30*sin(2*pi*x/365))          %% Still too small. Be bold let's see try 1000 >> x=linspace(0,1000); plot(x,50+30*sin(2*pi*x/365))         %% Oops, too big now >> x=linspace(0,365); plot(x,50+30*sin(2*pi*x/365))          %% just right. Oh yeah T=(2*pi/b)!  

That doesn't take too long, as we only need to change one numberand rerun the line. To take advantage of the \"up arrow\" trick, weput the commands on one line and combined the function evaluationwith the plot function.

Exercise 3a:
Find the suggested values by plotting the graphs until you canfigure out the answer.

  1. Repeating the above example, find one period of thefunction

(This is a bit tricky! Keep plottinguntil you clearly get one period shown in the viewing window.)

Answer & Explanation Solved by verified expert
3.7 Ratings (655 Votes)
Scriptclcclose allclear allfigured1b2pi20c05subplot321xlinspace0500    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students