Need help with a MATLAB Graph
10 views (last 30 days)
Show older comments
Hi everyone,
I'm currently stuck on a MATLAB graph problem. Both the problem and the code are seen below. I've done #1 easily, but I am stuck on the second problem.. I am unsure as to how I would go about doing it. Thanks!

%%circular spiral 1
t = linspace (0,8*pi,1000);
x = (2*t).*cos(t);
y = (2*t).*sin(t);
plot(x,y)
%%square spiral 1
t = linspace (0,8*pi,17);
x = (2*t).*cos(t);
y = (2*t).*sin(t);
plot(x,y)
%%circular spiral
2
a = 0-3.75*360;
r = (14.3/360)*a;
Now what???
1 Comment
Stephen23
on 7 May 2016
@Avery Buehler: please do not edit your questions and remove the test like this. We are not your own personal MATLAB service, we are volunteers who give our time to help everyone who reads this website. When you delete your question our answers stop making any sense. When we decide to help you, we have chosen to do so knowing that our answers can be useful to all browsers of this forum: when you delete your text you make our work meaningless, and you show that you do not value our goals or time, because you show that you do not care if our answers are useful to a anyone else. You are treating us as your own disposable asset.
Accepted Answer
Walter Roberson
on 1 May 2016
The part where it says "theta = 0-3.75*360" is giving a range of theta, 0 to 3.75*360 degrees.
But it is not clear what your question is. The problem description says that both specifications are for the same design, so it appears that there should be only two spirals produced.
1 Comment
More Answers (1)
John BG
on 2 May 2016
Edited: John BG
on 2 May 2016
You haven't scaled the radius yet.
First, reproduce exactly the diagram of the spiral so you know that at the end of the angle range you have 100mm.
t = linspace (0,8*pi-pi/2,1000);
x = t.*cos(t);
y = t.*sin(t);
figure(1);plot(x,y)
grid on; axis equal

now, focus on the last lap, the biggest radius:
right at the end the angle is 8*pi-pi/2, here y is minimum, and pi rad earlier y is max.
Your current y range is:
range(y)
=
44.006631955593235
Now scale the radius with this factor:
t = linspace (0,8*pi-pi/2,1000);
x = 100/44.006631955593235*t.*cos(t);
y = 100/44.006631955593235*t.*sin(t);
figure(1);plot(x,y)
grid on; axis equal

now your spiral outer range matches the sketch requirement of outer diameter of 100mm
range(y)
=
9.999999999999999e+01
You can check that the the condition 14mm between top largest turn and the one before of 14mm is also met. I checked with the marker, but you may want to check
y2-y1=14
where
y2=y(th=8*pi-3*pi/2)
y1=y(th=7*pi-3*pi/2)
This was the answer to point 1
Do you want give it a go to point 2 now before I do?
If you find this answer of any help solving your question,
please click on the thumbs-up vote link,
thanks in advance
John
0 Comments
See Also
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!