Hot answers tagged

5

Description This can be achieved in a number of ways. Here is an example with Text Example Manipulate[ Graphics3D[{ {Blue, Opacity[.5], Polygon[{{-1, -1, 0}, {1, -1, 0}, {1, 1, 0}, {-1, 1, 0}}]}, {Red, Thick, Arrow[{{0, 0, 0}, Flatten@{vermelho, 0}}]}, {Black, Thick, Arrow[{{0, 0, 0}, Flatten@{azul, 0}}]}, Style[Text[#, #] & @ Flatten @ {...


4

You have a few syntax errors. See below for corrected code: Manipulate[ sol = DSolve[ {Derivative[1][x][t] == -b x[t], Derivative[1][p][t] == -(1 - r) p[t] + b x[t], x[0] == 100, p[0] == 10}, {x[t], p[t]}, t ]; Plot[Evaluate[p[t] /. sol[[1, 1]]], {t, 0, 10}], {b, 0, 1}, {r, 0, 1} ]


4

Generating the outline By looking at the code we can infer that the position of the center of the outermost circle is given by outline[a_, t_] := Module[{ A = Accumulate[a Table[Cos[2 Pi i t], {i, Length[a]}]], B = Accumulate[a Table[Sin[2 Pi i t], {i, Length[a]}]] }, {Last[A], Last[B]}] This code comes straight from the one you posted; each ...


4

I can't follow what you wrote, but I made small example. Using If it checks which function selected, uses SetOptions[Plot... to set the options Manipulate[ If[f === Cos, SetOptions[Plot, {PlotStyle -> Red, Frame -> True}], SetOptions[Plot, {PlotStyle -> Blue, Frame -> False}] ]; Plot[f[x], {x, -2 Pi, 2 Pi}], {f, {Sin, Cos}} ]


3

Commenting out incomplete code and making up definitions for z and sq, this works: z = Sin; sq = Sign@*Cos; opt = {(*Exclusions\[Rule]DeleteDuplicates[Flatten[Table[{d+(n-1)*ct, d+(n-1)*ct+swt,d+n*ct},{n,1,nct}]]],*)PlotStyle -> Orange, AxesLabel -> {"μs", "V"}}; opt2 = {Exclusions -> All, ExclusionsStyle -> Dotted, PlotStyle -> ...


3

The way I read the documentation one can only control the background color of a Setter or SetterBar. That is to say the foreground color is not available to the user. If you are willing to use buttons, then I think you can accomplish your goal. I used Cyan and Gray rather than Blue and Black for visibility. Manipulate[ Column[{ {opt, colA, colB, colC}, ...


2

Example Description There is a number of errors in your code. Manipulate[Plot[B[X], {X, 0, 10}], {a, 1, 3}, {b, 0, 2}] In code above, you have a Manipulate which has three controls (X, a and b). The subject of your manipulation is Plot[B[X]], where B[X] takes a single argument X. Therefore, a and b are not utilized; hence an empty Plot. Recommendation ...


2

Second try Manipulate[ Module[{x, yNum, yDen}, {x, yNum, yDen} = {"x-Axis", "y-Axis num", "y-Axis den"} /. data; Pane["<your stuff here>"[x, yNum, yDen], {400, 100}] ], (* selector for axis categories *) {{axis, "x-Axis", "select"}, {"x-Axis", "y-Axis num", "y-Axis den"}, SetterBar[ Dynamic[axis, (axis = #; axiselement = Lookup[data, ...


2

Your initial and boundary conditions are inconsistent. Check NDSolve::ibcinc how to avoid that. Also I think you need additional boundary condition. Anyway I'm not sure your constant functions are good for boundary/initial conditions. The r domain includes zero and it gives error in your $1/r$ term. Using the recipe from above link and adding another ...


2

As I understand the question a curve fitting procedure that has the following properties is sought: Manually adjust the parameters to get an approximate fit. Use these parameters as the starting values for FindFit. Propagate the solution from FindFit back to the Manipulate parameters. Subsequently enable further editing of the Manipulate parameters and ...


2

A Copy-Paste of (or a shameless plagiarism to mark the question answered) link suggested by m_goldberg http://reference.wolfram.com/language/example/SimulateABouncingBall.html h = 20; a = 0.7; t0 = 10; (*time of flight*) ball[t_] = y[t] /. NDSolve[{y''[t] == -9.81, y[0] == h, y'[0] == 0, WhenEvent[y[t] == 0, y'[t] -> -a y'[t]]}, y, {t, 0, t0}][[1]...


2

Formatting clean-up and removing redundant Evaluate and Dynamic. In addition, tmax and c begin at 1 as opposed to 0. Manipulate[{ sol = NDSolve[{x''[t] + c*Sin[x[t]] == 0, x'[0] == a[[1]], x[0] == a[[2]]}, x, {t, 0, tmax}]; Plot[Evaluate[{x[t]} /. sol], {t, 0, tmax}, PlotRange -> All, PlotStyle -> {Thick, Red}]}, {c, 1, 10}, {tmax, 1,...


2

Manipulate[ Graphics3D[{{{Blue, Opacity[.5], Polygon[{{-1, -1, 0}, {1, -1, 0}, {1, 1, 0}, {-1, 1, 0}}]}, {Red, Thick, Arrow[{{0, 0, 0}, Flatten@{vermelho, 0}}]}, {Black, Thick, Arrow[{{0, 0, 0}, Flatten@{azul, 0}}]}}, SphericalRegion -> True, Boxed -> False, ViewAngle -> .37, Text[Panel["text", FrameMargins -> 0], ...


2

Updated using mem: as suggested by Simon Woods. Perhaps using Plot3D at a couple of intervals of tau will be enlightening. The results seems plausible based on the fact that old is a 1D function. ClearAll["Global`*"] G = 0.01; β = 1; ωc = 50; j = 1; ϕ = 0; θ = π/2; η = Exp[I ϕ] Tan[θ/2]; Clear[ψ] ψ[α_, χ_] := Exp[I α]*Tan[χ/2]; integralgamma[ω_, τ_] := ...


1

One way of plotting 4d data is with: DensityPlot3D[ Re[new[α, χ, τ] - old[τ]], {χ, 0, π}, {α, 0, 2 π}, {τ, 0.1, 1}, PlotPoints -> 11] To do this with manipulate, it is wise to do all the calculations first, and storing the values in a dataset. data = Table[ Table[{α, χ, Re[new[α, χ, τ] - old[τ]]}, {χ, π/ 16, π, π/8}, {α, 0, 2 π, ...


1

dynamicFit[data_, expr_, pars_] := With[{ n = Length[pars], x1 = Min[First /@ data], x2 = Max[First /@ data]}, DynamicModule[{pars2, fit, fitted = Null}, pars2 = Table[Unique[], n]; Do[pars2[[i]] = RandomReal[{-2, 2}], {i, n}]; Column[{ Sequence @@ Table[ With[{i = i}, Labeled[ Slider[Dynamic[pars2[[i]]], {-...


1

Initalize: data = Table[{x, 8 x^3 - 7 x^2 - 10 x + 1 + RandomReal[{-5, 5}]}, {x, -2, 2, 0.1}]; l = {a -> 1, b -> 1, c -> 1, d -> 1} Now run the following code, you can change the settings and then re-evaluate and it will start with the new parameters. aa = a /. l; bb = b /. l; cc = c /. l; dd = d /. l; l = FindFit[data, a x^3 + b ...


1

As mentioned by March, you didn't change one of the x1[t] terms to Subscript[x, 1][t] Your code should read: sol = DSolve[{Derivative[1][Subscript[x, 1]][t] == -(1 - Subscript[w, 1]) Subscript[x, 1][t] - Subscript[σ, 12] Subscript[x, 1][t], Derivative[1][p][t] == -(1 - Subscript[w, 2]) p[t] + Subscript[σ, 12] ...


1

Referring to the Manipulate documentation, you can change your sliders to input fields by going from control {x,0,10} to {x,0}. B = 2; Manipulate[ Show[{Graphics[{Opacity[0.5], Red, Rectangle[{1, 0}, {2, 1}]}, PlotRange -> {{-1, 2}, {-3, 3}}, Axes -> True, AxesOrigin -> {0, 0}], ParametricPlot[{x* Cos[\[Theta]] - (P*x^2)/(6*C*...


1

This is a refactored / slimmed version of the code in your answer: Manipulate[ With[{selected = category[[startPosition ;; endPosition]]}, BarChart[ selected[[All, whichBarChart]], ChartLabels -> selected[[All, label]], BarOrigin -> Left, ImageSize -> Large ] ], {{startPosition, 1}, {1, 6}}, {{endPosition, 5}, {5, 10}}, {...


1

Got it. Removed Take and All, replacing with Range[startPosition,endPosition] Manipulate[ Switch[whichBarChart, 5, BarChart[category[[Range[startPosition, endPosition], 5]], ChartLabels -> category[[Range[startPosition, endPosition], label]], BarOrigin -> Left, ImageSize -> Large], 6, BarChart[category[[Range[startPosition, ...



Only top voted, non community-wiki answers of a minimum length are eligible