How to plot the input variables vs functions using input variables?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
Walter Roberson
2013년 9월 25일
편집: Walter Roberson
2013년 9월 25일
Where is your call to do the plotting ? Where is your call to the bisection function?
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!