NAN problem in MATLAB, Surf command

2 views (last 30 days)
nargess
nargess on 5 Jan 2014
Commented: Walter Roberson on 5 Jan 2014
hi dear friends I am back with another problem. I am trying to write a code in MATLAB to plot the following series, but it doesn't work.
I took the ";" to see where the problem is. when I changed m's range to for example 1 to 100 it gives the values for S1 , but as I change it to higher number it returns:
S1= NAN
. . . S1= NAN
here is my code!(first I just want to calculate the series and then I will multiply it by (T1*2) (by the way the ranges for x and y are given and i can not change them)
for x=0:0.01:0.3;
for y=0:0.01:0.4;
Sum1=0;
for m=1:10000
S1=((1-cos(m*pi))/(m*pi))*((sinh(m*pi*(0.4-y)/0.3))/sinh(m*pi*0.4/0.3))*(sin(m*pi*x/0.3))
Sum1=Sum1+S1;
end
end
(my other question is if I can use 'Surf to plot T in x and y ranges?) I will appreciate your help, I am new to MATLAB. thank you :)
  1 Comment
Walter Roberson
Walter Roberson on 5 Jan 2014
My suspicion would be that you are running into zero divided by zero, or else zero times infinity

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!