Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Help writing two equations in Matlab (Please view Attachment)

1 visualizzazione (ultimi 30 giorni)
Yianni
Yianni il 26 Ott 2014
Chiuso: MATLAB Answer Bot il 20 Ago 2021
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 Commenti
Star Strider
Star Strider il 26 Ott 2014
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 il 26 Ott 2014
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 *

Risposte (0)

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by