How to plot the input variables vs functions using input variables?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I've tried to plot f(N) vs N but I am unable to get any lines on the graph. Just some spots. I need to plot the function using each N vs each N used?
Function
function f = dopdensity(N)
f = 2/((1.25494e-17)*(N+(sqrt(N^2 + 1.54256e20))))-6.5e6;
Bisection
function [root,fx,ea,iter]=bisect(func,xl,xu)
if nargin<3,error('at least 3 input arguments required'),end
test = func(xl) * func(xu);
if test>0,error('no sign change'),end
if nargin<4||isempty(es), es=0.0001;end
if nargin<5||isempty(maxit), maxit=50;end
iter = 0; xr = xl; ea = 100;
while (1)
xrold = xr;
xr = (xl + xu)/2;
iter = iter + 1;
if xr ~= 0,ea = abs((xr - xrold)/xr) * 100;end
test = func(xl)*func(xr);
if test < 0
xu = xr;
elseif test > 0
xl = xr;
else
ea = 0;
end
if ea <= es || iter >= maxit,break,end
end
root = xr; fx = func(xr);
1 Kommentar
Walter Roberson
am 25 Sep. 2013
Bearbeitet: Walter Roberson
am 25 Sep. 2013
Where is your call to do the plotting ? Where is your call to the bisection function?
Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!