Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Help writing two equations in Matlab (Please view Attachment)

1 vue (au cours des 30 derniers jours)
Yianni
Yianni le 26 Oct 2014
Clôturé : MATLAB Answer Bot le 20 Août 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 commentaires
Star Strider
Star Strider le 26 Oct 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 le 26 Oct 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 *

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by