Hi. Can someone explain to me why I am getting a series of dots in a straight line when i try to plot this in matlab E=0:0.01:70; X=sqrt((75-E)/E); plot(E,X) Thanks
Try the following: Code ( (Unknown Language)): E=0:0.01:70; X=sqrt((75-E)./E); plot(E,X) The use of the dot (.) before multiply and division allows the array values to be used in proper order as you intended. This notation is necessary because Matlab allows multiplication and division (inversion) of matrices.
Thanks that did it. Also if you have a look at http://en.wikibooks.org/wiki/Materials_in_Electronics/Confined_Particles/1D_Finite_Wells where they have a graph closer to the end of the page they manage to plot Y=tan(((sqrt(2*me*E))/(hbar))*L); how is it that when I plot this on matlab with similar method to plotting as for X I get something that looks like noise rather than the tan expected. The constants I use are hbar=6.582e-016 me=9.11e-31 L=0.2*10^-9 what am I doing wrong?
When I use the following code, I don't get noise. Code ( (Unknown Language)): [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]hbar=6.582e-016[/SIZE][/FONT] [SIZE=2][FONT=Courier New]me=9.11e-31[/FONT][/SIZE] [SIZE=2][FONT=Courier New]L=0.2*10^-9[/FONT][/SIZE] [SIZE=2][FONT=Courier New]E=0:0.01:70;[/FONT][/SIZE] [SIZE=2][FONT=Courier New]Y=tan(((sqrt(2*me.*E))/(hbar))*L);[/FONT][/SIZE] [SIZE=2][FONT=Courier New]plot(E,Y)[/FONT][/SIZE] [/SIZE][/FONT] However, I think you need to check your units. The range of values does not seem realistic. I think the issue may stem from using E in eV and me in kg. Note that sqrt(me*E)/hbar is not going give you the correct values, unless E is in J and me is in kg, with hbar in units of Js. I mentioned this potential "units" problem in the other post. It's usually safer to stick with SI units consistently.