Sum of the series with two variable

조회 수: 2 (최근 30일)
Kemal Bey
Kemal Bey 2021년 4월 19일
댓글: Abdalrahman Marshoud 2022년 5월 9일
Given that
x=0:0.01:1;
t=0:0.001:0.1;
n is from 1 to 20 (not infinity)
How to make plot(x,u)? Please help!!!
  댓글 수: 2
the cyclist
the cyclist 2021년 4월 19일
What help do you need? Are your familiar with at least the basics of MATLAB syntax and operations? If not, then I suggest you watch the free MATLAB Onramp tutorial.
If you are familiar with the basics, then I suggest you write out as much as you can yourself, and then post where you are stuck.
Kemal Bey
Kemal Bey 2021년 4월 19일
편집: the cyclist 2021년 4월 19일
x = 0:0.01:1;
t = 0:(2/100):2;
u=zeros(1,numel(t));
for n= 1:20
u=u-((4/(pi.^3)).*((-1).^(n)-1).*exp(-(n.^2).*(pi.^2).*(t/10)).*sin(n.*pi.*x))/n.^2;
end
plot(x,u,'b')
That is my code. I should get parabolic (symmetric) distribution of heat over a rod. But I obtained something that is not symmetric paraboloid. If you replace t with t = 0:(2/100):2, it will become noticeable

댓글을 달려면 로그인하십시오.

채택된 답변

David Hill
David Hill 2021년 4월 19일
편집: David Hill 2021년 4월 20일
[x,t]=meshgrid(0:.01:1,0:.001:.1);
u=zeros(size(x));
for n=1:100
u=u+((-1)^n-1)/(n^2)*exp(-n^2*pi^2*t/10).*sin(n*pi*x);
end
u=u*4/(pi)^3;
surf(x,t,u);
  댓글 수: 2
Kemal Bey
Kemal Bey 2021년 4월 20일
Thanks a lot
Abdalrahman Marshoud
Abdalrahman Marshoud 2022년 5월 9일
If n is infinity, how can i plot it?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Waveform Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by