Effacer les filtres
Effacer les filtres

I am trying to generate these 3 plots

1 vue (au cours des 30 derniers jours)
Mr.DDWW
Mr.DDWW le 3 Mar 2022
  5 commentaires
Mr.DDWW
Mr.DDWW le 3 Mar 2022
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 le 3 Mar 2022
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 = 

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 3 Mar 2022
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.

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by