Hello,(adsbygoogle = window.adsbygoogle || []).push({});

I am having a problem getting this MATLAB program to work:

function [ ] = PlotISD()

W = 10^-4;

L = 10^-5;

mu = 400;

Cox = 1.73*10^-6;

VFB = -0.75;

gamma = 0.235;

phiT = 0.0259;

IDS1 = 0:0.05:1.5;

IDS2 = IDS1;

for VGBi = 0:0.05:1.5

Ys0 = FindYs0(VGBi);

YsL = FindYsL(VGBi);

Ysm = (Ys0 + YsL)/2;

am = 1 + gamma/(2*sqrt(Ysm));

index = (VGBi+0.05)./0.05;

IDS1(index) = (W/L)*mu*Cox*(VGBi-VFB-Ysm-gamma*sqrt(Ysm))*(YsL-Ys0);

IDS2(index) = (W/L)*mu*Cox*am*phiT*(YsL-Ys0);

end

VGB0 = 0:0.05:1.5;

IDST = IDS1(1:31) + IDS2(1:31);

plot(VGB0,IDS1,VGB0,IDS2,VGB0,IDST)

end

FindYs0 and FindYsL are functions that do not change the value of VGBi. I keep getting the error message:

??? Attempted to access IDS1(3); index must be a positive integer or logical.

Error in ==> PlotISD at 19

IDS1(index) = (W/L)*mu*Cox*(VGB-VFB-Ysm-gamma*sqrt(Ysm))*(YsL-Ys0);

Last time I checked 3 is a positive integer. What is going on here? Any help would be appreciated.

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# MATLAB plotting/indexing problem

Loading...

Similar Threads for MATLAB plotting indexing |
---|

MATLAB Plotting Coordinate Transformations in Matlab |

MATLAB Plotting animations (time-evolution) |

MATLAB Does anyone had this plotting problem with MATLAB? |

MATLAB Matlab's plot command |

MATLAB Matlab -- how to make a smooth contour plot? |

**Physics Forums | Science Articles, Homework Help, Discussion**