odd result when plotting offset circle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
odd result when plotting offset circle
This isn't urgent, I'm just curious here, but in the attached Prime 8.0 file I'm plotting an offset circle in steps from 0° to 360°. When I reduce the resolution by going to 10° steps I get the interesting figure on the right. Why is that happening?
Solved! Go to Solution.
- Labels:
-
Mathcad Usage
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
1) In your sheet you set line style to "none" so we possibly won't see what your picture shows.
2) You don't show HOW you would manage a step width of 10°. If you do it correctly, you will see exactly what you expect.
Here with Line Style set to full line:
I guess you just used
which would explain what you posted.
That way there still is created a vector with 361 elements!!
But only elements #0,10,20,... get the values you intend, the rest is filled with zeros by default.
You may consider using something like
or
A less "legal" but convenient way uses the undocumented (and so unreliable) trick that an inline evaluation turns a range into a vector
Don't try to set the unit deg at the result - it will throw an error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
1) In your sheet you set line style to "none" so we possibly won't see what your picture shows.
2) You don't show HOW you would manage a step width of 10°. If you do it correctly, you will see exactly what you expect.
Here with Line Style set to full line:
I guess you just used
which would explain what you posted.
That way there still is created a vector with 361 elements!!
But only elements #0,10,20,... get the values you intend, the rest is filled with zeros by default.
You may consider using something like
or
A less "legal" but convenient way uses the undocumented (and so unreliable) trick that an inline evaluation turns a range into a vector
Don't try to set the unit deg at the result - it will throw an error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you Werner!
1) Yes, sorry - I forgot to mention I changed i:=0,1..360 to i:=0,10..360 to go to 10 degree steps.
2) I didn't know i:0,10..N still produced N+1 elements. I thought it would produce N/10.
That undocumented trick is very interesting.
Thank you for getting me back on track!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
2) I didn't know i:0,10..N still produced N+1 elements. I thought it would produce N/10.
The range "values" (actually a range is kind of an implicit loop) are used to address the vector elements.
If the range ist defined as i:=0,10..N and you assign v[i := ..., then you assign values to vector element #0, #10, #20, .... and the elements with other numbers like #3 oder #12 are left undefined and so Prime sets them to zero. You can't expect that with i=10 Prime assign the value to vector element #1.
When you write v[20:=123 you create a vector with 21 elements. element #20 holds the value 123 and the elements from #0 to #19 are set to 0.
