필터 지우기
필터 지우기

I am trying to generate these 3 plots

조회 수: 1 (최근 30일)
Mr.DDWW
Mr.DDWW 2022년 3월 3일
답변: Walter Roberson 2022년 3월 3일
  댓글 수: 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에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by