Newbie question
Mostrar comentarios más antiguos
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=500
c=340
wavelength=c/f
SB=30
BR=15
SG=2
RG=2
BG=5
pi=3.14159265358979
L_pR=67
L_pA=70
Rvalues=[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+BeranekSecondHalfvalues
A_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
3 comentarios
bym
el 13 de Nov. de 2011
use the {}code button to format your code
Walter Roberson
el 13 de Nov. de 2011
http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup
Tom
el 13 de Nov. de 2011
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!