## MATLAB: Issues with Matrix Multiplication

electrical engineeringmatrix division

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 1×17 array (v_D in the code) by a 3×1 (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 endendlegend('T=23.89 deg C','T=37.78 deg C','T=51.67 deg C'),grid on,xlabel('btitv'),ylabel('bfiti (v)'),title('bfitA Plot of Current as a Function of the Applied Voltage Across a Diode')`

## Best Answer