Info

此问题已关闭。 请重新打开它进行编辑或回答。

Help writing two equations in Matlab (Please view Attachment)

1 次查看(过去 30 天)
I have two equations and I want to loop a value for 'n' from 1 to 50. I want to put these equations in so that Ln (equation 1) is part of Bn (equation 2). The constants are given below:
S = 1200;
Lx = 0.127;
Ly = 0.203;
k = 0.16;
I have tried this and all it gives for Bn is negative values of zero which is not right:
Ln = zeros(1,nmax); Bn = zeros(1,nmax);
for n = 1:nmax
Ln(n)= ((2*n-1)*pi)/(2*Lx);
Bn(n) = ((2*S)/(k*Lx))*(((-1)^n)./((Ln(n).^3).*cosh(Ln(n)*Ly)));
end
  2 个评论
Star Strider
Star Strider 2014-10-26
I get ‘B(n)’ as a rapidly decaying oscillation asymptotic to 0 when I write my own code for your equation. If this is not the result you expect, and you copied your function correctly, check your constants.
Hendrik
Hendrik 2014-10-26
It is because according to your formula the values for Bn become extremely small. And because the first value is -10.07 which his much much larger, the later entries in the array will appear as 0. For example Bn(50) is 1.4e-112
Also if you use a for loop, there is no need to put a dot in front of the / or the *

回答(0 个)

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by