2 Improved formatting
source | link

i want to add a variable amount of variables to manipulate, but i got stuck at one point and can't figure out a solution (even after reading here for hours...).

I have a function (e.g. here a gaussian):

f[x_, a_,\[Mu]_μ_,\[Sigma]_]σ_] := a Exp[-(x - \[Mu]μ)^2/(2 \[Sigma]^2σ^2)]/(Sqrt[2 Pi] \[Sigma]σ)

and define now a sum of these function, which i would like to plot using manipulate:

n=3;
test = {A[#], \[Mu][#]μ[#], \[Sigma][#]σ[#], m[#]} & /@ Range[n];
func = f[x, ##] & @@@ test;

Setting initial values like this:

initialvalues = {50, 5, 20, 50, 50, 40, 100, 80, 20};
values = Partition[initialvalues, n];
rangelow = values*0.7;
rangehigh = values*1.3;

Now i want to plot this, after setting initial values with manipulate, e.g. like this:

With[{func = func},
    Manipulate[
        Show[Plot[func, {x, 0, 100}, PlotRange -> All]],
    'List of manipulate arguments'
        ]
]

With a list like this:

testlist = 
 Flatten[{{{A[#], values[[#, 1]]}, rangelow[[#, 1]], 
  rangehigh[[#, 1]]}, {{\[Mu][#]μ[#], values[[#, 2]]}, 
  rangelow[[#, 2]], 
  rangehigh[[#, 2]]}, {{\[Sigma][#]σ[#], values[[#, 3]]}, 
  rangelow[[#, 3]], rangehigh[[#, 3]]}} & /@ Range[n], 1]

But I can't figure out how to remove the outer bracketsand there should be a better solution.

Thanks in regards!

i want to add a variable amount of variables to manipulate, but i got stuck at one point and can't figure out a solution (even after reading here for hours...).

I have a function (e.g. here a gaussian):

f[x_, a_,\[Mu]_,\[Sigma]_] := a Exp[-(x - \[Mu])^2/(2 \[Sigma]^2)]/(Sqrt[2 Pi] \[Sigma])

and define now a sum of these function, which i would like to plot using manipulate:

n=3;
test = {A[#], \[Mu][#], \[Sigma][#], m[#]} & /@ Range[n];
func = f[x, ##] & @@@ test;

Setting initial values like this:

initialvalues = {50, 5, 20, 50, 50, 40, 100, 80, 20};
values = Partition[initialvalues, n];
rangelow = values*0.7;
rangehigh = values*1.3;

Now i want to plot this, after setting initial values with manipulate, e.g. like this:

With[{func = func},
    Manipulate[
        Show[Plot[func, {x, 0, 100}, PlotRange -> All]],
    'List of manipulate arguments'
        ]
]

With a list like this:

testlist = 
 Flatten[{{{A[#], values[[#, 1]]}, rangelow[[#, 1]], 
  rangehigh[[#, 1]]}, {{\[Mu][#], values[[#, 2]]}, 
  rangelow[[#, 2]], 
  rangehigh[[#, 2]]}, {{\[Sigma][#], values[[#, 3]]}, 
  rangelow[[#, 3]], rangehigh[[#, 3]]}} & /@ Range[n], 1]

But I can't figure out how to remove the outer bracketsand there should be a better solution.

Thanks in regards!

i want to add a variable amount of variables to manipulate, but i got stuck at one point and can't figure out a solution (even after reading here for hours...).

I have a function (e.g. here a gaussian):

f[x_, a_,μ_,σ_] := a Exp[-(x - μ)^2/(2 σ^2)]/(Sqrt[2 Pi] σ)

and define now a sum of these function, which i would like to plot using manipulate:

n=3;
test = {A[#], μ[#], σ[#], m[#]} & /@ Range[n];
func = f[x, ##] & @@@ test;

Setting initial values like this:

initialvalues = {50, 5, 20, 50, 50, 40, 100, 80, 20};
values = Partition[initialvalues, n];
rangelow = values*0.7;
rangehigh = values*1.3;

Now i want to plot this, after setting initial values with manipulate, e.g. like this:

With[{func = func},
    Manipulate[
        Show[Plot[func, {x, 0, 100}, PlotRange -> All]],
    'List of manipulate arguments'
        ]
]

With a list like this:

testlist = 
 Flatten[{{{A[#], values[[#, 1]]}, rangelow[[#, 1]], 
  rangehigh[[#, 1]]}, {{μ[#], values[[#, 2]]}, 
  rangelow[[#, 2]], 
  rangehigh[[#, 2]]}, {{σ[#], values[[#, 3]]}, 
  rangelow[[#, 3]], rangehigh[[#, 3]]}} & /@ Range[n], 1]

But I can't figure out how to remove the outer bracketsand there should be a better solution.

1
source | link

Variable number of controls in manipulate

i want to add a variable amount of variables to manipulate, but i got stuck at one point and can't figure out a solution (even after reading here for hours...).

I have a function (e.g. here a gaussian):

f[x_, a_,\[Mu]_,\[Sigma]_] := a Exp[-(x - \[Mu])^2/(2 \[Sigma]^2)]/(Sqrt[2 Pi] \[Sigma])

and define now a sum of these function, which i would like to plot using manipulate:

n=3;
test = {A[#], \[Mu][#], \[Sigma][#], m[#]} & /@ Range[n];
func = f[x, ##] & @@@ test;

Setting initial values like this:

initialvalues = {50, 5, 20, 50, 50, 40, 100, 80, 20};
values = Partition[initialvalues, n];
rangelow = values*0.7;
rangehigh = values*1.3;

Now i want to plot this, after setting initial values with manipulate, e.g. like this:

With[{func = func},
    Manipulate[
        Show[Plot[func, {x, 0, 100}, PlotRange -> All]],
    'List of manipulate arguments'
        ]
]

With a list like this:

testlist = 
 Flatten[{{{A[#], values[[#, 1]]}, rangelow[[#, 1]], 
  rangehigh[[#, 1]]}, {{\[Mu][#], values[[#, 2]]}, 
  rangelow[[#, 2]], 
  rangehigh[[#, 2]]}, {{\[Sigma][#], values[[#, 3]]}, 
  rangelow[[#, 3]], rangehigh[[#, 3]]}} & /@ Range[n], 1]

But I can't figure out how to remove the outer bracketsand there should be a better solution.

Thanks in regards!