2
votes
%%PMOS
Cox = 10;
Co = .25;
Cjo = .6 ;
mj = .3 ;
phi_b = 1;
Cjswo = 0.066;
mjsw = 0.1 ;
phi_bsw = .5 ;
Ls = 240000 ;
W = 20 ;
Vd = 0:0.1:1 ;   
%%%%%
**Cj = Cjo/((1-(Vd/phi_b))).^mj;**          
Cjsw = Cjswo/((1-(Vd/phi_bsw))).^mjsw;
%%%%%%%%%%%%
Cdiff_PMOS = Cj*Ls*W + Cjsw*(2*Ls + W);
plot(Vd,Cdiff_PMOS);

The error it shows is

Error using  / 
Matrix dimensions must agree.

Error in P4_ee115_hw1 (line 14)
Cj = Cjo/((1-(Vd/phi_b))).^mj;

Any tips on how to fix it will be really apprecitated. Thanks .

1

1 Answers

1
votes

If you put a ./ on the line for Cj and Cjsw this will work. So:

Cj = Cjo./((1-(Vd/phi_b))).^mj;
Cjsw = Cjswo./((1-(Vd/phi_bsw))).^mjsw;

You are getting this error because you are trying to divide a scalar by a vector and Matlab is picky about this. What you want is to do this element wise which is what the ./ will do and will remedy your code.