I have a function h of multiple variables that I want to plot With independent variables i, l,f and δ. The question I have in hand is to show how the solution curve changes as the parameters change so I need to plot the function h with several different values of each independent variables. I also tried to plot it using excel. The plot that I obtained by Mathematica is the following which is not similar with the plot done by excel. The peak value should be at δ=0.65. enter image description here

The h versus δ plot done by excel is the following. enter image description here what is the problem with it? It is not clear for me. Is there anyone who can help me?

The following code is editable. But the format is changed while I paste here. The real format look like the image.

 m=(a+b+(1/(0.85*f) ((a*d)/δ-a*d-b*e)))^1/2;
  • 4
    $\begingroup$ Welcome on Mathematica.StackExchange! Please provide copyable code so that other users can play with it without having to retype everything. $\endgroup$ – Henrik Schumacher May 7 '18 at 9:05
  • $\begingroup$ would you give me a permission to edit the question. I will provide the code on that. Thank you. $\endgroup$ – Belay May 7 '18 at 9:30
  • 1
    $\begingroup$ @Belay there is an 'edit' link right below tags. $\endgroup$ – Kuba May 7 '18 at 9:59
  • 3
    $\begingroup$ There doesn't seem to be anything wrong with this code-wise. FWIW Your excel plot looks like the garbage you get from excel if you plot too few points. (I'd like to meet the genius at microsoft who decided to make "smoothed" plots the default. ) $\endgroup$ – george2079 May 7 '18 at 14:23
  • $\begingroup$ What values of i, l, and f did you use for the Excel plot? $\endgroup$ – Alan May 7 '18 at 14:30

Ignoring the issue with Excel (which I would guess is due to round-off errors with the large numbers you're using or what @George2079 suggests) you can use Grid to get all of your plots.

 c = (((1 - δ)*g) - (b*e))/(0.85*f);
 e = 260.86;
 d = 213.63;
 n = 16;
 b = 803.84;
 g = 4000000;
 p = 4000;
 a = (g - b*e - 0.85*c*f)/d;
 m = (a + b + (1/(0.85*f) ((a*d)/δ - a*d - b*e)))^1/2;
 k = (a + b + (((1 - δ)*g - b*e)/(0.85*f)))*
    m^2/12 - (b*(m/2 - 25 - n/2)^2) - i;
 h = π^2/p^2*
   a*(200000*i/a + 200000*(b*(m/2 - 25 - n/2)^2)/a + 0.6*l*k/a);
 Grid[{{Plot[m, {δ, 2/10, 9/10}, 
     PlotRange -> {Automatic, {0, 160000}},
     Frame -> True, FrameLabel -> {"δ", "m"}],
    Plot[k, {δ, 2/10, 9/10}, 
     PlotRange -> {Automatic, {0, 7 10^14}},
     Frame -> True, FrameLabel -> {"δ", "l"}]},
   {Plot[h, {δ, 2/10, 9/10}, 
     PlotRange -> {Automatic, {0, 1.1 10^13}},
     Frame -> True, FrameLabel -> {"δ", "h"}]}}],

 {i, 5580000, 90100000, Appearance -> "Labeled"},
 {l, 30000, 42000, Appearance -> "Labeled"},
 {f, 11.33, 45.33, Appearance -> "Labeled"},
 TrackedSymbols :> {i, l, f}]

Multiple plots

When i, l, and f are set to their minimum values, then the equation for h is

h = 1.50655*10^13-4.45728*10^13 δ+4.394*10^13 δ^2-1.44326*10^13 δ^3

That plot over the range of δ looks nothing like your Excel figure.

  • $\begingroup$ Your answer was very important for my work. I want to say thank you very much for taking the time to assist me. I need your further support. I want to optimize ‘h’ by varying δ with its range. So the plot should increase for some δ values and decrease for the remaining δ values. That is just to get one optimum peak value of δ which makes the ‘h’ value maximum. In addition to that, I want to see the effect of the variables i, l, f on ‘h’ . may you help me please? $\endgroup$ – Belay May 7 '18 at 17:53
  • $\begingroup$ In the range of $\delta$ of 0.2 to 0.9, no peaks are evident. All of your curves seem to be polynomials of $\delta$ of order 3 so solving for where there are peaks and troughs should be straightforward. $\endgroup$ – JimB May 7 '18 at 20:01
  • $\begingroup$ Yes, you are right, I got the same results. It seems polynomial, and solving the peak value is easy. But, I need to show that peak value with Mathematica plot other than solving for the value. I already solved the peak value in the excel data by using those equations used in Mathematica. But the difficulty is I couldn’t show it in Mathematica plot and manipulation. I will submit the excel data and the graph if you send me your email address. Here is my email address => nbelay2112@gmail.com. Thank you. $\endgroup$ – Belay May 8 '18 at 7:17
  • $\begingroup$ Another question which is not clear for me is , how to determine the PlotRnange values for h, k, and m as {0, 1.1 10^13}, {0, 7 10^14}}, and {0, 160000} respectively? $\endgroup$ – Belay May 8 '18 at 17:01
  • $\begingroup$ It appears from the data you sent that you've varied f, i, l, and $\delta$ roughly linearly from their low to their high values and then calculated the h values. The plot of $\delta$ vs h would not then show any meaningful relationship between $\delta$ and h. The problem is with how you attempt to construct the relationship between $\delta$ and h and not a problem with Excel or Mathematica. $\endgroup$ – JimB May 8 '18 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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