MATLAB: I dont get this; Unbalanced or unexpected parenthesis or bracket.; on the codes. What I did was putting’.’ next to high-lighted X,Y.

for n=1:k
T{n}=a(n)*sin(n*X.)*(exp(n*Y.)-exp(-n*Y.));
P;
P=P+T{n};
surf(X,Y,T);grid
hold on
end

Best Answer

X. is not valid MATLAB syntax. You cannot use . as part of a variable name (although it can be used in some array operations).
What do you think the period characters would do ?
Use this:
T{n} = a(n)*sin(n*X)*(exp(n*Y)-exp(-n*Y));
Related Question