Help me plot grafic pls.
1 回表示 (過去 30 日間)
古いコメントを表示


I want to plot the above graph according to the above equation. Can you help ?
0 件のコメント
回答 (2 件)
William Rose
2022 年 11 月 22 日
Yoiur foumula includes an infinite sum. Do a finite sum and see if it converges after 10 or 20 or 30 terms. When I do it, I see that the solution with n=20 is almost identical to the solution with n=10, and the solution with n=30 is not visibly differnt from the solution with n=20.
All three solutions look very different from the plot you posted. Perhaps I made a msitake. Check my work. Are you sure the plot you provided is a plot of the analytical solution using the equation shown? Why does R=1.04 appear in the plot, but not in the analytical solution?
x=0.5;
t=0:.0026:0.0702; %time vector
u1=zeros(size(t)); u2=u1; u3=u1; %allocate u
n1=1:10;
n2=1:20;
n3=1:30;
for i=1:length(t)
u=(0.63/pi^2)*(1./(n1.*n1)).*sin(n1*pi/1.5).*cos(100*n1*pi*t(i)/1.5).*sin(n1*pi*x/1.5);
u1(i)=sum(u);
u=(0.63/pi^2)*(1./(n2.*n2)).*sin(n2*pi/1.5).*cos(100*n2*pi*t(i)/1.5).*sin(n2*pi*x/1.5);
u2(i)=sum(u);
u=(0.63/pi^2)*(1./(n3.*n3)).*sin(n3*pi/1.5).*cos(100*n3*pi*t(i)/1.5).*sin(n3*pi*x/1.5);
u3(i)=sum(u);
end
plot(t,u1,'-r.',t,u2,'-g.',t,u3,'-b.');
legend('n=10','n=20','n=30'); grid on; xlabel('Time'); ylabel('u')
Try it.
0 件のコメント
David Hill
2022 年 11 月 22 日
What is R? The solution does not match your graph.
x=.5;
t=0:.0025:.07;
n=(1:100)';
H=1./n.^2.*sin(n*pi/1.5).*cos(100*n*pi/1.5.*t).*sin(n*pi/1.5*x);
u=0.63/(pi)^2*sum(H);
plot(t,u,'*-')
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!