Issues with Matrix Multiplication

6 Ansichten (letzte 30 Tage)
Matthew Lintern
Matthew Lintern am 30 Jun. 2016
Kommentiert: Matthew Lintern am 30 Jun. 2016
Hi all. I have a script for calculating the current flowing through a diode at 3 different temperatures. I am having problems with the division of 2 matrices found in the exponent of the equation. The equation is of course correct, mathematically sound etc. I have done the usual checks etc with matrix operations, but what it comes down to is that I'm trying to divide a 1x17 array (v_D in the code) by a 3x1 (T' in the code) array. The code can be found below. Any answers/help is greatly appreciated!
q=1.602e-19; k=1.38e-23; I0=2.0e-6; v_D=-1.0:0.1:0.6; T=[23.89 37.78 51.67]';
for ii=1:length(T)
i_D=I0.*(exp((q*v_D)./(k*T))-1);
if ii==1
plot(v_D,i_D,'r','LineWidth',2)
hold on
elseif ii==2
plot(v_D,i_D,'b','LineWidth',2)
elseif ii==3
plot(v_D,i_D,'k','LineWidth',2)
hold off
end
end
legend('T=23.89 deg C','T=37.78 deg C','T=51.67 deg C'),grid on,
xlabel('\bt\itv'),ylabel('\bf\iti (v)'),
title('\bf\itA Plot of Current as a Function of the Applied Voltage Across a Diode')

Akzeptierte Antwort

Thorsten
Thorsten am 30 Jun. 2016
i_D=I0.*(exp((q*v_D)./(k*T(ii)))-1);

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by