1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica cannot plot this graph

  1. Jan 24, 2009 #1
    General question regarding mathematica. I am trying to make a plot of [tex] A Sin(\omega t - \pi / 2) [/tex] but it seems that mathematica cannot plot this graph without having A and omega defined. Is there a way to have mathematica plot this given the variable A and frequency omega?

    Basically, instead of plotting it on a number line, would mathematica be able to label the y axis in terms of A (instead of 1, 2, 3...) and also label the x axis with omega instead of pi, 2pi, .. etc.

    Currently using:
    Plot[A Sin[\[Omega] t - \[Pi]/2] , {t, 0, 6 Pi}]
     
  2. jcsd
  3. Jan 25, 2009 #2

    CompuChip

    User Avatar
    Science Advisor
    Homework Helper

    Re: Mathematica

    What I usually do is fix some values for A and omega and adjust the axes accordingly. For example, try something like this

    Code (Text):

      y[t_] := A Sin[\[Omega] t - \[Pi]/2]
    Block[{A = 1, \[Omega] = 2},
     Plot[y[t], {t, 0, 10 \[Omega]},
      Ticks -> {Table[{j \[Omega], j "\[Omega]"}, {j, 0, 10}],
        Table[{k A, k "A"}, {k, -1, 1, 0.25}]}]
     ]
     
    Note the use of Ticks, which puts different marks on the axes, and how I used Table to make precisely those marks that I want.

    I hope the code is self-explanatory, otherwise I am counting on your questions :)
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?