to fix plotting code

1 Ansicht (letzte 30 Tage)
sevgul demir
sevgul demir am 8 Dez. 2021
Kommentiert: sevgul demir am 8 Dez. 2021
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
  1 Kommentar
sevgul demir
sevgul demir am 8 Dez. 2021
omg i'm little embarrassed thank you ^^

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

KSSV
KSSV am 8 Dez. 2021
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')

Weitere Antworten (0)

Kategorien

Mehr zu Fit Postprocessing finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by