0

I have this for loop below:

for Vsb = 0:1:5
    Vtn = Vto+y*(sqrt(SurfPot + Vsb) + sqrt(SurfPot));
end

I want to plot Vtn vs Vsb for all the values of Vsb. I was trying to use the plot function but it does not seem to work.

1
  • what exactly does "does not seem to work" mean ? Commented Sep 29, 2011 at 3:34

1 Answer 1

2

the Vtn variable should be an array with 6 elements.

Vtn=[];
for Vsb = 0:1:5
    Vtn(Vsb) = Vto+y*(sqrt(SurfPot + Vsb) + sqrt(SurfPot));
end

then just plot the Vtn as a function of Vsb with the following

figure 
plot(0:5,Vtn,'*r');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.