how to write the expression ((pi*epsil​on)/ln((D-​r)/r)) in matlab?

2 次查看(过去 30 天)
c = (pi*epsilon)/log((D-r)/r);
This code doesn't work
  2 个评论
Walter Roberson
Walter Roberson 2020-5-18
The code could fail in some cases involving non-scalars, as the A/B operator is sort of like A*pinv(B) except with some size restrictions. The element-by-element division operator is ./ not /

请先登录,再进行评论。

回答(1 个)

David Hill
David Hill 2020-5-18
Are all the variables arrays of equal size? If so, then you need the element-wise operator.
c = (pi*epsilon)./log((D-r)./r);

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by