I have got a long expression called h, which I don't think is relevant to define here for the issue I have. Just know that it was defined through symbols, like

 h=C1*Sin[...]*Integrate[...] etc. 

So my definition has no [x_] or := It seems to work well until here (I get the long expression for h in terms of the symbols) Then, what I would like to do is defining a function with all the undefined parameters that appear in h, that is, in my case:


After that, I would like to make a Manipulate plot such as, for example:

Plot[Re[h1[x, alpha, beta, L, Lc]], {x, 0.1, 1}, 
PlotLegends -> {"h(x)"}], {beta, 0, 1},{alpha, 0, 1},{L, 0, 1},{Lc, 0, 1}]

However, it doesnt work. Where are my mistakes?


1 Answer 1


Model your code on the following:

Block[{x, a, b}, h[x_, a_, b_] = a Sin[b x]];
  Plot[h[x, a, b], {x, 0, 10},
    PlotRange -> {-1, 1}],
  {a, -1, 1},
  {b, π/4, 2 π, π/4}]


  • $\begingroup$ What is the block function doing? I would like to remind you also that on the rhs of h[x_,a_,b_] I dont want to right the expression but to state simply h Is that allowed? $\endgroup$
    – Andrea G
    Mar 27, 2017 at 7:54
  • $\begingroup$ I am getting $Aborted or an empty Plot. I read somewhere else that this is due to long expressions inside Manipulate. Some sort of bug/crash? $\endgroup$
    – Andrea G
    Mar 27, 2017 at 9:07
  • $\begingroup$ @AndreaG. Blockprotects the rhs of the definition from being contaminated by global definitions of x, a and b. Sorry but I can't answer the additional questions. The one about h being allowed make no sense. The one about your crashes/aborts can't be tested without knowing the expression you are using. $\endgroup$
    – m_goldberg
    Mar 27, 2017 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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