Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Plot semicircle and discrete projection (Chebyshev nodes)

Subject: Plot semicircle and discrete projection (Chebyshev nodes)

From: Dennis Foray

Date: 26 May, 2012 10:07:50

Message: 1 of 2

Hello,

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 = []

I'm running around in circles as I fail to formulate the circvec vector that defines the point on the circle that is to be projected on the subspace of x....


Help would be appreciated!

Subject: Plot semicircle and discrete projection (Chebyshev nodes)

From: Roger Stafford

Date: 26 May, 2012 13:02:16

Message: 2 of 2

"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

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us