How to plot the input variables vs functions using input variables?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Walter Roberson
le 25 Sep 2013
Modifié(e) : Walter Roberson
le 25 Sep 2013
Where is your call to do the plotting ? Where is your call to the bisection function?
Réponses (0)
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!