Can Mathematica Plot Functions with Undefined Parameters?

Click For Summary
SUMMARY

Mathematica can plot functions with undefined parameters by utilizing the Ticks option to customize axis labels. In the discussion, the user seeks to plot the function A Sin(ωt - π/2) without defining A and ω, and instead label the axes in terms of these variables. The provided solution involves defining a function y[t_] and using the Block function to set values for A and ω while employing the Ticks option to create custom labels for both axes. This approach allows for a flexible representation of the function in terms of its parameters.

PREREQUISITES
  • Familiarity with Mathematica syntax and functions
  • Understanding of plotting functions in Mathematica
  • Knowledge of parameterized functions
  • Basic concepts of axis customization in plots
NEXT STEPS
  • Explore advanced plotting techniques in Mathematica
  • Learn about the Block function in Mathematica for variable scoping
  • Investigate the use of Ticks for custom axis labeling in Mathematica
  • Study parameterized plotting in Mathematica for more complex functions
USEFUL FOR

Mathematica users, educators, and students looking to enhance their plotting skills, particularly those interested in visualizing functions with variable parameters.

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

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
1
Views
2K
Replies
9
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K