Issues with Matrix Multiplication

1 回表示 (過去 30 日間)
Matthew Lintern
Matthew Lintern 2016 年 6 月 30 日
コメント済み: Matthew Lintern 2016 年 6 月 30 日
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 件のコメント
Muhammad Usman Saleem
Muhammad Usman Saleem 2016 年 6 月 30 日
what is your error?

サインインしてコメントする。

採用された回答

Thorsten
Thorsten 2016 年 6 月 30 日
i_D=I0.*(exp((q*v_D)./(k*T(ii)))-1);
  1 件のコメント
Matthew Lintern
Matthew Lintern 2016 年 6 月 30 日
Many thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSources についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by