cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Divide by zero

manjulavijh
Participant

Divide by zero

Hello 

URGENT HELP NEEDED!

I have this expression and conditions

manjulavijh_2-1578200090117.png

 

manjulavijh_3-1578200149723.png

phi has conditonal values depending on L. Since L is in the denominator, and is varied from 0-30 nm and more. this expression is giving divide by zero error. How can I compute the valus of phi. I want to plot potential (phi) againt L.

Please help

Thank you

 

18 REPLIES 18

Re: Divide by zero

Hi

 

For a start you have named both functions the same.  Rename the second one.

 

Regards

Terry

Re: Divide by zero

Hi Terry 

thank you for your response

i did that

 

manjulavijh_0-1578209838292.png

manjulavijh_1-1578209867241.png

manjulavijh_2-1578209879754.png

 

It sayd thie expression in RED has to be scalar

I want to plot phi wrt L

Re: Divide by zero

Hi,

 

Now turn the equation in red into a vectorised equation.  This will get a vector of answers. highlight the red equation and press [Ctrl][-].

 

Regards

Terry

Re: Divide by zero

Hello

YEs did that

is this wat you mean?

manjulavijh_0-1578210962139.png

Now this again gives an error ( Divide by ZEro)

I have given conditions for potential for L<0, 0-L-30nm, L>0

the expression of phi has  L in denominator. is it because of that? Then How to i give conditions a plot over entire device?

I am new to this tool

Re: Divide by zero

Hi,

 

Don't despair we will get there.  This one is subtle.

L is on the denominator of the first function so will give an error if  L is zero.

You start the definition of L the range variable with zero.

Start  the definition of range variable L greater than zero.

 

Regards

Terry

 

Re: Divide by zero

Change phi such that the first statement says

Vbis if L ≤ 0

and the second says

phi2(...) if 0 < L ≤ 30*10^-9.

 

Success!
Luc

Re: Divide by zero

You wrote 0*10^-9 twice in your function.

Didn't you mean 1*10^-9 or simply 10^-9 ?

Because the way you wrote it, in case of L=0 phi2 is tried to evaluated and this of course must fail.

If 0*10^-9 was done on purpose, you should apply Luc's suggestion (changing < to <= and vice versa according).

 

It should not be really necessary to rename the second function but its definitely good habit to do so, to use different names for different things.

 

If your goal is simply to plot phi over L, you don't necessarily need to define a range for L - you may use Mathcad's quickplot feature (using L for plotting without defining it)  and set the range for L directly in the plot.

If you need the range for L to have more control over the spacing of the values, you should NOT follow the definition of L by an evaluation (the = sign). This evaluation turns the range into a vector (an undocumented feature) and is the reason you need to use vectorization when you calculate phi with this vector.

If you don't turn L into a vector, no vectorization is necessary when calculating phi.

 

BTW, you could really help us in our attempts to help you by attaching your worksheet, if possible.

 

 

Re: Divide by zero

Hey Okay

I have done quickplot. but there is some problem still. can you plz look into it

thanks in advance

 

 

Re: Divide by zero

Hey Werner

Below is the mathcad file. Please help as it is a lil urgent. I will be thankful

 

Please help if you get where am i going wrong. I am unable to decide the values of x and y and changing them is making a change in the plot

the desired graph should be like this. ignore the labels in this as it is from some other simulation.

manjulavijh_0-1578225668228.png

 

Re: Divide by zero

You define km:=m*pi/L. and before that you defined m:=1 and L:=30*10^-9. This means that km =pi/(30*10^-9) = pi/30 * 10^9.

Since you did NOT define km to be a function of m and L, km is and remains that constant pi/30 * 10^9 throughout the rest of the sheet.

Is this what you want?

Likewise for km1.

Then in your definition of phi2 you have a summation that essentially does nothing. Summing for m=1 to 1 is just a single term...

 

Success!
Luc

Re: Divide by zero

km is an eigen value.

I dont know how is it to be defined. by formula is it wat it is written.

do i mk it a function?

 

Tags (1)

Re: Divide by zero

yes the summation i have written from  m=1 to 1, as if i write summation m=1 to infinity, it doesnt give a valid value of phi. it gives a much much greater value like >10^377... it gives this message. so i was trying keeping m=1 to 1

Re: Divide by zero


Please help if you get where am i going wrong. I am unable to decide the values of x and y and changing them is making a change in the plot


I am not sure what you mean by that.

Obviously you got the plot to work finally.

The range you use is rather coarse, I guess using something like L:=0, 0.05*10-^9 .. 40*10^-9 could be more appropriate.

Also in your definition of Phi you allow very low values of L - as close to zero as possible. That means that your function values get lower and lower as L approaches 0 from the right. It may be appropriate to limit this by a value like 10^-9 or whatever seems feasible.

Werner_E_0-1578229034624.png

If the resulting graph is not what you expected, then something with your formulas is not OK. I can't tell what.

Turning km and km1 into functions of m may be a starting point, but even if you do so, the sum (which you limited to run from m=1 to m=1) still does not converge, so it looks like something else in your formulas is faulty, too.

 

 

Re: Divide by zero

HEy

L ranges from 0 to 30nm and that is why i want to see the potential in the device from this length

 

about km and km1, these are eigen values. i tried making them a function of m and L but it didnt give correct results.

 

as far as limits of summation are concerned, if i summ from 1 to infinity it gives a v large value of phi which matcad doesnt calculate

 

 

Re: Divide by zero

"about km and km1, these are eigen values. i tried making them a function of m and L but it didnt give correct results."

 

Just making km and km1 functions doesn't help. You have to follow through. If km is a function of m and L, then so should Asn and Adn be functions of m and L.

Note that when you use Asn(y) in the definition of D1m(m) you call it with parameter y, which is some length (as it is in the nano-range) whereas your variable m appears to be unitless.

I suspect there's more than one error in your formulae. I propose you start adding units to your expressions. That should help you diagnose where errors may be.

How about this as a start:

LucMeekes_0-1578231524907.pngLucMeekes_1-1578231563868.png

I may have set some units incorrectly. (It's been a long time that I worked with MOS models.) But I'm sure that you can correct that.

Notice how evaluation of D1m(1) produces an error. It is due to Asn and Adn being called with y instead of 1.

 

Success!
Luc

 

Re: Divide by zero

Thanks, I will try that for sure

Asn

this is a fourier coefficient of source boundary potential. and has the value of that integral.

 

BTW ho does one add units? if you could throw some clarity on this

Thanks!

Tags (1)

Re: Divide by zero

Hi

the units option inside the insert menu is disabled in mathcad sheet

i think i had earlier disabled all units.

Can you please help me to enable units as advised by you. or do i have to write every formula again?

thanks

Re: Divide by zero

Check menu option "Tools" => "Worksheet options".

You can select the 'unit system' and whether or not 'dimensions' are shown.

 

Success!
Luc

Announcements
Check out the latest
Mathcad Tip
"PTC Mathcad 15 / Prime 1-6 Update."