Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Error while trying to use diff comand

1 Ansicht (letzte 30 Tage)
Nathan Donatell
Nathan Donatell am 10 Nov. 2019
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
This is the code that I created and I am trying to differentiate Id and Vt but every time I run the program I keep getting this error, "Difference order N must be a positive integer scalar." I am not sure how to get rid of this error.
Here is my code:
x = 0:.01:.65;
q=1.6022e-19;
C=28.73;
T=273+C;
k=1.3806e-23;
Is=1.0e-12;
V= x;
n=1;
Vt=(k*T)/q;
Id=Is*((exp(V/(n*Vt))));
plot(V,Id)
axis([-0.5,0.7,-0.1,0.3])
grid on
title('I-V Characteristics of Diode')
xlabel(' Voltage ')
ylabel(' Current ')
R = diff(Vt,Id);

Antworten (1)

Star Strider
Star Strider am 10 Nov. 2019
It is not clear to me what you want to do.
If you want to take the numerical derivative of ‘Id’ using step size ‘Vt’ use the gradient function as:
R = gradient(Id,Vt);
This also has the advantage that ‘R’ is the same size as ‘Id’.

Diese Frage ist geschlossen.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by