필터 지우기
필터 지우기

How to plot the input variables vs functions using input variables?

조회 수: 2 (최근 30일)
Aaron
Aaron 2013년 9월 25일
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
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개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by