How can I plot the graph for this function?

조회 수: 5 (최근 30일)
Gufran Malik
Gufran Malik 2022년 6월 7일
편집: Torsten 2022년 8월 21일
f(x)=symsum(2^(-m*x)*(gamma(m*x+j-1+1)/gamma(m*x-1+1))*h(j/m),j.0.Inf)
where h(j/m)=(j/m)^2+1, m=100.
Please help me out.
  댓글 수: 5
Gufran Malik
Gufran Malik 2022년 6월 10일
Thanks @Dyuman Joshi but this is giving error.
Dyuman Joshi
Dyuman Joshi 2022년 6월 11일
It worked on my pc without any errors, but it took an eternity to run :')
(i3-5th gen, 8 gb ddr3 ram)

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

채택된 답변

Torsten
Torsten 2022년 6월 12일
편집: Torsten 2022년 6월 12일
m = 100;
h = @(x) x.^2+1;
x = 0:0.01:10.0;
tol = 1e-16;
for i = 1:numel(x)
Lm(i) = fun_Lm(m,h,x(i),tol);
end
plot(x,Lm)
function value = fun_Lm(m,h,x,tol)
value = 0.0;
error = Inf;
j = 0;
summand = 1.0;
while error > tol
value = value + summand;
error = abs(summand);
summand = summand * (m*x+j) * 1/2 * 1/(j+1) * h((j+1)/m)/h(j/m);
j = j + 1;
end
value = value/2^(m*x) ;
end
  댓글 수: 1
Gufran Malik
Gufran Malik 2022년 8월 17일
@Torsten Thank you so much. It worked for me and helped me a lot.

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

추가 답변 (1개)

Gufran Malik
Gufran Malik 2022년 8월 17일
How can we plot this function? @Torsten Please help me with this
  댓글 수: 4
Gufran Malik
Gufran Malik 2022년 8월 21일
@Torsten Thank you so much.
Gufran Malik
Gufran Malik 2022년 8월 21일
@Walter Roberson Thank you so much.

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

카테고리

Help CenterFile Exchange에서 Symbolic Variables, Expressions, Functions, and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by