I am trying to generate these 3 plots

1 次查看(过去 30 天)
  5 个评论
Mr.DDWW
Mr.DDWW 2022-3-3
clc;clear all;
n=100000;
alphat=1;
y_b=linspace(0,1);
% y_b=.1
for j=1:length(y_b)
sum_D=0;
for i=1:n
sum_D=sum_D+(((-1)^(i-1))/(((i-1)+0.5)*pi))*exp(-((i-1)+0.5)^2*pi^2*alphat)*cos((i-1)+0.5)*pi*y_b(j);
end
F(j)=2*sum_D;
end
plot(y_b,F);grid on;
I tried but not correct
Walter Roberson
Walter Roberson 2022-3-3
Regardless of the theoretical shape, you can see from the below with very reduced n that after n = 2, the terms are too small to make any difference in the summation.
n=5.0000;
alphat=1;
y_b=linspace(0,1,10);
% y_b=.1
Pi = sym(pi);
for j=1:length(y_b)
sum_D = sym(zeros(1,n));
for i=1:n
sum_D(i)=(((-1)^(i-1))/(((i-1)+0.5)*Pi))*exp(-((i-1)+0.5)^2*Pi^2*alphat)*cos((i-1)+0.5)*Pi*y_b(j);
end
vpa(sum_D)
F(j)=2*sum(sum_D);
end
ans = 
ans = 
ans = 
ans = 
ans = 
ans = 
ans = 
ans = 
ans = 
ans = 
F(1:min(end,10)).'
ans = 
vpa(ans)
ans = 
plot(y_b,F);grid on;
simplify(F ./ F(2))
ans = 
vpa(ans)
ans = 

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2022-3-3
sum_D(i)=(((-1)^(i-1))/(((i-1)+0.5)*Pi))*exp(-((i-1)+0.5)^2*Pi^2*alphat)*cos((i-1)+0.5)*Pi*y_b(j);
Look at that. How does the change of j affect it ?
j does not show up until y_b(j) which is a multiplier. And it is constant for all the different I values. So the result is going to be same as if you calculated for all the i values without including the y_b(j) term, and then multiplied by the y_b(j) term afterwards.
Which means that the result is going to be exactly the same each time, except multiplied by y_b(j) . And since the y_b is linear, that means you get a linear result.

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by