Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Plot semicircle and discrete projection (Chebyshev nodes)
Date: Sat, 26 May 2012 13:02:16 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 24
Message-ID: <jpqk8o$da5$1@newscl01ah.mathworks.com>
References: <jpqa1l$4jg$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-04-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1338037336 13637 172.30.248.35 (26 May 2012 13:02:16 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 26 May 2012 13:02:16 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:769090

"Dennis Foray" wrote in message <jpqa1l$4jg$1@newscl01ah.mathworks.com>...
> I would like to construct an informative plot explaining the relationship between chebyshev nodes and the 0:pi semicircle. 
> 
> Plotting a semicircle using ezplot and the implied function x^2+y^2=1 is no problem; beyond that I would like to plot exactly 100 equidstant vertical lines of specific color to illustrate the projection nature and have them end as a blue dot on the x-Axis.
> 
> Now I would use a for loop and plot a line between chebvec = [cos((2k-1)/(2*100))*pi 0] and circvec = []
- - - - - - - - -
 hold on
 t = linspace(0,pi,500);
 plot(cos(t),sin(t),'w-') % The semi-circle
 n = 100; % <-- For clarity of plotting use a smaller number than 100 here
 for k = 1:n
  u = (2*k-1)/(2*n)*pi;
  c = cos(u); s = sin(u);
  plot([c,c],[s,0],'b-',c,0,'bo',c,s,'bo') % The vertical lines
 end
 hold off
 axis equal

(Modify plot symbols and colors according to your taste.)

  Note that these vertical lines are not equidistant because the nodes are not equidistant.  What are equal are the arc lengths in which they divide up the semicircle.

Roger Stafford