Timeline for Understanding how to loop over different variables in Mathematica
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 11, 2019 at 15:33 | comment | added | Michael E2 |
You can "wrap the above three steps in a function" with findData[a_, b_, c_] := Module[{fitData, fitParams, d, f, g, x}, fitData = Table[H[a, b, c, x], {x, 0, 20}]; fitParams = FindFit[fitData, d x^2 + f x + g, {d, f, g}, x]; {a, b, c, d, f, g} /. fitParams] -- Well, your example code didn't show a 2D Plot[] per se, so I'm assuming the Table[] is what you meant. And I skipped the Export , since I think separating the data generation from the I/O makes handling the data more flexible..
|
|
Jul 10, 2019 at 19:21 | vote | accept | Henry Shackleton | ||
Jul 10, 2019 at 15:43 | answer | added | MassDefect | timeline score: 5 | |
Jul 10, 2019 at 15:43 | answer | added | Sjoerd Smit | timeline score: 5 | |
Jul 10, 2019 at 15:08 | history | edited | Henry Shackleton | CC BY-SA 4.0 |
added 409 characters in body
|
Jul 10, 2019 at 15:02 | comment | added | Somos |
You can use CompoundExpression with semicolons anywhere in place of a single expression.
|
|
Jul 10, 2019 at 14:57 | comment | added | rhermans | It's always easier to answer a question that contain an actual minimal working example in Mathematica code in formatted form. | |
Jul 10, 2019 at 14:37 | history | asked | Henry Shackleton | CC BY-SA 4.0 |