Issues with Matrix Multiplication

2 vues (au cours des 30 derniers jours)
Matthew Lintern
Matthew Lintern le 30 Juin 2016
Commenté : Matthew Lintern le 30 Juin 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')
  1 commentaire
Muhammad Usman Saleem
Muhammad Usman Saleem le 30 Juin 2016
what is your error?

Connectez-vous pour commenter.

Réponse acceptée

Thorsten
Thorsten le 30 Juin 2016
i_D=I0.*(exp((q*v_D)./(k*T(ii)))-1);
  1 commentaire
Matthew Lintern
Matthew Lintern le 30 Juin 2016
Many thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB 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!

Translated by