How to Plot Truncated Summation Functions without any add-ons

조회 수: 5 (최근 30일)
Anthony Koning
Anthony Koning 2022년 2월 20일
댓글: Anthony Koning 2022년 2월 20일
Hello, I'm trying to figure out how to go about plotting a truncated summation function such as
without the use of any add-ons. Almost every resourse I'm finding for Matlab requires a toolbox add-on that I do not have access to, such as PDF from the stats/machine toolbox, or syms from the symbolic math toolbox. If anyone could give a hint on how to approach this, I would apprectate it.

답변 (1개)

David Hill
David Hill 2022년 2월 20일
y=@(M,x)2/pi*sum((-1).^((1:M)-1).*cos(2*(1:M)-1)*pi/2.*x'./(2*(1:M)-1),2)+0.5;
x=-10:10;
plot(x,y(3,x),x,y(10,x),x,y(20,x));%plot vs. different values of M
  댓글 수: 1
Anthony Koning
Anthony Koning 2022년 2월 20일
I appreciate the answer, but the graph of this plot doesn't make much sense to me, just being straight lines. I understand it compares a handful of values for N, but shouldn't the graph have a sinusoidal shape since the graph is a sum of cosines?

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

카테고리

Help CenterFile Exchange에서 Directed Graphs에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by