2
$\begingroup$

Below is my code containing two lists of data, I need the graph to show one exponential trendline from an exponential equation, but it currently shows one trendline per item in the list. I am sure this is an easy fix, but I am new to mathematica so I am struggling a bit. There is also an image of the output.

Current := Is * (Exp[(V/Vt)] - 1)
Is = {0.055015, 0.00598, 0.0706, 0.0356, 0.1231, 0.158, 0.04873, 
  0.0928, 0.0642, 0.07535}
Vt = 0.045
V = {0.759, 0.660, 0.768, 0.735, 0.790, 0.797, 0.750, 0.780, 0.760, 
  0.767}
Plot[Current, {V, -1, 1.5}]

enter image description here

$\endgroup$
1
$\begingroup$

See if this is what you seek:

is = {0.055015, 0.00598, 0.0706, 0.0356, 0.1231, 0.158, 0.04873, 0.0928, 0.0642, 0.07535};
vt = 0.045;
v = {0.759, 0.660, 0.768, 0.735, 0.790, 0.797, 0.750, 0.780, 0.760, 0.767};

ClearAll[current]
current[v_] := is*(Exp[(v/vt)] - 1)
ListPlot@Transpose@{v, current[v]}

enter image description here

As an aside, I recommend avoiding single uppercase letters as variable names, as well as uppercase names in general, since those may conflict with built-in function names.

$\endgroup$
  • $\begingroup$ This is exactly what I needed! Thank you! $\endgroup$ – Molly McDonough Feb 11 at 23:20
  • $\begingroup$ @Molly You are very welcome! $\endgroup$ – MarcoB Feb 11 at 23:21
  • $\begingroup$ Do you happen to know how to get a best fit equation from that graph? $\endgroup$ – Molly McDonough Feb 11 at 23:48
  • $\begingroup$ @Molly To what model would you like to fit it? What would be the parameters? you may want to look into NonlinearModelFit. $\endgroup$ – MarcoB Feb 12 at 0:22

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.