MATLAB: Solving an equation with an array, then plotting using semilogx

semilogx

I'm trying to plot a function using semilogx and have two questions. Firstly, how do you solve an equation for a dependent variable when the independent variable is an array rather than a fixed numerical value, i.e. i want to solve y for all values of x within the array. Secondly, how can I then plot (using the function semilogx) this graph of y vs. x?

Best Answer

x=0:1e10;%might need to reduce this if you have memory problems
b=0.000138;
lambdap=(-b+sqrt(b^2+4*b./(x+1)))/2;
lambdan=(-b-sqrt(b^2+4*b./(x+1)))/2;