Path: news.mathworks.com!newsfeed-00.mathworks.com!pln-e!spln!lex!extra.newsguy.com!newsp.newsguy.com!drn
From: Patrick Flaherty <Patrick_member@newsguy.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Draw a star.
Date: 20 Aug 2006 17:20:27 -0700
Organization: NewsGuy - Unlimited Usenet $19.95
Lines: 61
Message-ID: <ecau8b0197n@drn.newsguy.com>
References: <ec8smq02a8a@drn.newsguy.com> <ellieandrogerxyzzy-2008061008490001@dialup-4.232.60.187.dial1.losangeles1.level3.net>
NNTP-Posting-Host: p-194.newsdawg.com
User-Agent: Direct Read News 4.70
Xref: news.mathworks.com comp.soft-sys.matlab:365598


thanx Roger - yes that worked perfectly.

I assume the 'cos(theta),sin(theta)' bit was as in
e^(i*theta) = cos(theta) + i*sin(theta)?

And playing with the code below a bit, the 4/5s and
the 4 (defining the theta range) are what get you
the 5-pointed star?  Although exactly how this works,
I'm not yet sure.  (but Matlab is a great tool for
just playing with things [and learning them thereby]).

That was the warm-up.  I'm actually trying to work on
a homework problem for my wife's eldest brother's eldest
son. The son is now in his first year at a technical
university.  The program is bio-chemical engineering but
of course he needs to learn to program and is doing
so for the first time.

I'm a programmer and so I'd been helping him out already,
when he was first using SciLab.  Which, as best I could make
out (and I hadn't seen SciLab before either) is maybe 
something like a student version of Matlab.

He's in Malaysia (my wife's from Malaysia).

The actual problem is to recreate the star that's in the upper
left of the Malaysian flag (drawing it in Matlab of course).
The star, that is, that's just to the right of the crescent
moon (Muslim symbolism).

However the star there is 14-pointed (not 5).  I tried switching
the 4/5 and 4 in your code to 14/15 and 14 and I got something
vaguely like a 14-pointed star except that there was a '15th'
point which didn't close at its tip.  Maybe the odd and even
(number of points) cases differ ...

In accomplishing the task, the hmwk gives a small amount
of (doubtless invaluable) information.

1. start by defining two vectors of complex #s Zsub1 = r*e^(i*theta)
and rsubZsub2 = 0.5*rsubZsub1

(Thus r diminishing by 1/2 with each subsequent term.)

and 2. normalize the scales with a third Zsub3 where
Zsub3*(2n-1) = Zsub1*(n).

pat



In article
<ellieandrogerxyzzy-2008061008490001@dialup-4.232.60.187.dial1.losangeles1.level3.net>,
Roger Stafford says...
>
>theta = 0:4/5*pi:4*pi;
>plot(cos(theta),sin(theta),'y-')
>axis equal
>
>Roger Stafford