> > I tried the codes but there is error. > > > > In an assignment A(I) = B, the number of elements > in > > B and I must be the same. > > > > How to identify the error? > > > > Thank you. > > > > Regards, > > Anne > > I could identify one error in the code: in the > definition of term1, you will have to use y(i) > instead of y. > And take care that w,h and z are scalars, not > vectors. > > eps=1e-8; > > For i = 1:21 > y(i) = 5*(i-1); > term1 = 1.0; > term2 = 1.0; > n = 1; > a = 0; > b = 0; > While (term1 > eps) | (term2 > eps) > term1 = 1/n^3 [1-(cosh(n*pi* y(i)/h))/(cosh(n*pi* > w/h))]* sin(n*pi* z/h); > term2 = 192*h/(n^5* pi^5* w)*tanh(n*pi*w/h) > a=a+term1; > b=b+term2; > n=n+2; > end > b=1-b; > ux(i)=48*Q/(pi^3*h*w)*a/b; > end > > Best wishes > Torsten.
One more error:
Instead of While (term1 > eps) | (term2 > eps) use While (abs(term1) > eps) | (abs(term2) > eps)