|
"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
|