# MATLAB: Newbie question

variable plot script

Okay, so I've got a solution, which I've successfully turned into a script, so I can run it and change values as I want. But what if I want to make a plot of one of the variables against the solution? I've tried changing the variable in question into 1:10, or x, but then it just doesn't work. I can run it with a different value for the variable a few times and make comments based on that, but it'd be nicer just to have a plot showing how the variable affected the final answer.
Here's my script (I just copied and pasted it from the script editor window): –
f=500c=340wavelength=c/fSB=30BR=15SG=2RG=2BG=5pi=3.14159265358979L_pR=67L_pA=70Rvalues=[45 45 45 45 sqrt(45^2+4^2) sqrt(45^2+4^2) sqrt(45^2+4^2) sqrt(45^2+4^2)]Lvalues=[sqrt(SB^2+(BG-SG)^2)+sqrt(BR^2+(BG-RG)^2) sqrt(SB^2+(BG-SG)^2)+sqrt(BR^2+(BG+RG)^2) sqrt(SB^2+(BG+SG)^2)+sqrt(BR^2+(BG-RG)^2) sqrt(SB^2+(BG+SG)^2)+sqrt(BR^2+(BG+RG)^2) sqrt(SB^2+(BG-SG)^2)+sqrt(BR^2+(BG-RG)^2) sqrt(SB^2+(BG-SG)^2)+sqrt(BR^2+(BG+RG)^2) sqrt(SB^2+(BG+SG)^2)+sqrt(BR^2+(BG-RG)^2) sqrt(SB^2+(BG+SG)^2)+sqrt(BR^2+(BG+RG)^2)]Nvalues=(2/wavelength)*(Lvalues-Rvalues)Triangle_biValues=5+20*log10((sqrt(2*pi*Nvalues))./tanh(sqrt(2*pi*Nvalues)))BeranekSecondHalfvalues=20*log10(Lvalues./Rvalues)A_biValues=Triangle_biValues+BeranekSecondHalfvaluesA_biNEGdBValues=10.^(-A_biValues/10)NR_b=10*log10(sum(A_biNEGdBValues))L_pB=L_pR-((10*log10(10^(-0/10)+10^(-0/10)))-NR_b)
That didn't paste well, so I've put the script file in my public dropbox too – http://dl.dropbox.com/u/11341635/WideBarrierQ1a.m
I want to see how changing BG affects the solution as a plot.
Tom

BGs = [1 2 3 4 5 6 7 8 9 10];  %the list of values you want to useL_pB = zeros(1,length(BGs));   %more efficient to preallocatefor K = 1 : length(BGs)  BG = BGs(K);
endplot(BGs, L_pB, 's')