Can Mathematica Plot Functions with Undefined Parameters?

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 2K views
LocationX
Messages
141
Reaction score
0
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}]
 
Physics news on Phys.org


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

Code:
  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 :)