Cannot Plot Multiple Functions on Same Graph

1 view (last 30 days)
Hello,
I am trying to plot two different Maxwellian functions on the same graph. The only difference between them is that one has a cosntant added to it. I know that the constant should move the first function to the right about 0.003E-19 so it is a very small difference, however it is still big enough to be visually noticeable wrt the scales on the graph. To see if this did not plot due to some issue with the functions being nearly the same, I also plotted another test function called "test" in the code below to see if that would work and that function is not being plotted either. My code is only plotting one Maxwellian function. Any ideas?
T = 1000;
k = 1.381E-23; %Boltzman's constant
cone = 2/((k*T)^(3/2)); %Constant infront of the Maxwellian distribution function
energyaddition = 2000; %E-field strength of experiment in (eV)
entrans = energyaddition*(1.6022E-19);
energyaddition2 = 0; %E-field strength of experiment in (eV)
entrans2 = energyaddition2*(1.6022E-19);
syms Ein
%Create Maxwellian distribution function (In terms of E)
maxd = entrans + cone*sqrt(Ein/pi)*exp(-Ein/(k*T)); %Define Maxwellian distribution function
maxd2 = entrans2 + cone*sqrt(Ein/pi)*exp(-Ein/(k*T)); %Define Maxwellian distribution function
test = (1.5E+19)*sin((1.5E-19)*Ein);
hold on
fplot(Ein,maxd,[0 1E-19])
fplot(Ein,maxd2,[0 1E-19])
fplot(Ein,test,[0 1E-19])
hold off

Accepted Answer

KALYAN ACHARJYA
KALYAN ACHARJYA on 14 Aug 2019
Edited: KALYAN ACHARJYA on 14 Aug 2019
There are 3 plots, check it carefully
fplot(Ein,maxd,[0 1E-19],'r','linewidth',2)
hold on
fplot(Ein,maxd2,[0 1E-19],'--ob')
fplot(Ein,test,[0 1E-19],'g')
hold off
Change the scale range/differences, you will find it.
  1 Comment
Tom Keaton
Tom Keaton on 14 Aug 2019
Edited: Tom Keaton on 14 Aug 2019
So it actually was because the two Maxwellian plots are so similar that they are pretty much plotted ontop of each other. Thanks for pointing that out!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!