My suspicion would be that you are running into zero divided by zero, or else zero times infinity
NAN problem in MATLAB, Surf command
1 次查看(过去 30 天)
显示 更早的评论
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154615/image.jpeg)
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 :)
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Assumptions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!