to fix plotting code

1 次查看(过去 30 天)
sevgul demir
sevgul demir 2021-12-8
diary ex9_1.dat
% Diode parameters
vt = 25.67e-3;
v = [0.1 0.2 0.3 0.4 0.5 0.6 0.7];
i = [0.133e-12 1.79e-12 24.02e-12 321.66e-12 4.31e-9 57.69e-9 772.58e-9];
%
lni = log(i); % Natural log of current
% Coefficients of Best fit linear model is obtained
p_fit = polyfit(v,lni,1);
% linear equation is y = m*x + b
b = p_fit(2);
m = p_fit(1);
ifit = m*v + b;
% Calculate Is and n
Is = exp(b)
n = 1/(m*vt)
% Plot v versus ln(i), and best fit linear model
plot(v,ifit,'w', v, lni,'ow')
axis([0,0.8,-35,-10])
xlabel('Voltage (V)')
ylabel('ln(i)')
title('Best fit linear model')
diary
even i try to run it, does not show anything... i am gonna upload the result what i am getting
dont know what's the problemm

采纳的回答

KSSV
KSSV 2021-12-8
You are using white color to plot, so the plots are not visible.
Change the line:
plot(v,ifit,'w', v, lni,'ow') % Change the color w to someother
to:
plot(v,ifit,'r', v, lni,'or')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by