Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Help writing two equations in Matlab (Please view Attachment)

1 Ansicht (letzte 30 Tage)
Yianni
Yianni am 26 Okt. 2014
Geschlossen: MATLAB Answer Bot am 20 Aug. 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 Kommentare
Star Strider
Star Strider am 26 Okt. 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 am 26 Okt. 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 *

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by