Is it possible to draw a spectral histogram from two random sets ? More specifically, I have these two random functions (fmin
, fmax
and Nwaves
would be variables in a Manipulate box) :
fmin = 0;
fmax = 4;
Amplitude[k_] := Amplitude[k] = If[k == 0, 1, RandomReal[{0.5, 1}]]
Frequency[k_, fmin_, fmax_] := Frequency[k, fmin, fmax] = If[k == 0, 1, RandomReal[{fmin, fmax}]]
where k
is an integer variable going from k = 0
up to k = Nwaves
. Lets take Nwaves = 50
. I would like to plot the random frequencies on an horizontal axis, and their random amplitude on the vertical axis to define a spectral plot.
How can we do this plot in Mathematica ? Please, note that I'm using Mathematica version 7.
EDIT : This is almost a solution, but it's not exactly like an "histogram" (with thin vertical bars) :
Clear["Global`*"]
fmin = 0;
fmax = 4;
Amplitude[k_] := Amplitude[k] = If[k == 0, 1, RandomReal[{0.5, 1}]]
Frequency[k_, fmin_, fmax_] := Frequency[k, fmin, fmax] = If[k == 0, 1, RandomReal[{fmin, fmax}]]
ListPlot[
Table[{Frequency[k, fmin, fmax], Amplitude[k]}, {k, 0, 50}],
PlotRange -> {{0, 5}, {0, 1}},
PlotStyle -> {Blue, AbsolutePointSize[10]},
AspectRatio -> 1,
Frame -> True,
ImageSize -> 500
]