2
$\begingroup$
a = Sin[2*x];
b = N[Subdivide[0, \[Pi], 99]];
c = Table[a /. x -> b[[i]], {i, 1, Length[b]}];
data = Transpose[{b, c}];
p1 = Plot[a, {x, 0, \[Pi]}];
p2 = ListPlot[data];
Show[p1, p2, AxesStyle -> Black, 
 AxesLabel -> {HoldForm[beam length], HoldForm[normalizd amplitude]}, 
 PlotLabel -> None, 
 LabelStyle -> {FontFamily -> "Arial", 20, GrayLevel[0]}]

I have a small piece of code, I am getting a plot but it is not a normalized one, how to scale the plot so that I can visualize the end result with x varies from 0 to 1 and y varies from -1 to 1.

$\endgroup$
  • $\begingroup$ Us this PlotRange -> {{0, 1}, {-1, 1}} $\endgroup$ – zhk Dec 20 '18 at 4:53
3
$\begingroup$

You need DataRange:

domain = {0, Pi};
points = 100;
x = Array[# &, points, domain];
y = Sin[2 x];
ListPlot[y, DataRange -> {0, 1}]
$\endgroup$
0
$\begingroup$
f = Function[x, Sin[2*Pi*x]]
p12 = Plot[f[x], {x, 0, 1}, Mesh -> 99,
  AxesLabel -> {"beam length", "normalized amplitude"}, 
  LabelStyle -> {FontFamily -> "Arial"}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.