Plotting curves with increasing radius

Dear all,
I wanted to know if there is any way to plot a curve with increasing radius. This curve has to go around a circle.
Thanks for your help.

댓글 수: 8

Roger Stafford
Roger Stafford 2013년 8월 21일
Do you mean the radius - that is, the distance - from some fixed point is increasing, or do you mean the radius of its local radius of curvature is increasing? There is a big difference in these two concepts. What determines the way in which this radius increases? We need more information to be able to help you effectively, James.
Image Analyst
Image Analyst 2013년 8월 21일
Do you mean a spiral? If so, wouldn't both the radius and the radius of curvature increase as the spiral gets larger and larger?
James
James 2013년 8월 21일
@ Roger Stafford: I mean the distance from a fixed point is increasing.
@ Image Analyst: N, I don't mean a spiral. Spirals don't work in my case.
Image Analyst
Image Analyst 2013년 8월 21일
Then why not just call line() over and over again with longer lines? Why are you calling it a radius? Radius usually means something more or less circular. Please upload a diagram of what you want so we won't have to spend more time guessing what you want.
Walter Roberson
Walter Roberson 2013년 8월 21일
What aspect of a spiral does not work for you?
James
James 2013년 8월 21일
@ Roger Stafford: A spiral does not work because, I am not looking for a circle. I want a curve with increasing radius (from a fixed point) over a part of a circle. It would be easier to explain if could just show you a picture of what I was trying to achieve. Sorry about the confusion.
@ Image Analyst: I will be glad to upload an image but I am not sure how to do so here. If you could guide me I will do that. Sorry for the confusion.
Image Analyst
Image Analyst 2013년 8월 21일
Bring up your diagram somehow on the computer, be it in Photoshop or whatever. Type alt-Printscreen to capture the current window into the clipboard. Go to http://snag.gy and type control-V to paste it in. Note the URL it gives you and come back here and tell us what it is.
James
James 2013년 8월 21일
@ Image Analyst: Thank you telling me how to do that. Below is the URL for the image. Hope it helps. The figure is of 3 different curves. The center is a circle, the other two I have the data for them but I am not sure not to plot them.

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2013년 8월 21일

0 개 추천

Your sample diagram look like spirals to me, other than that the radius might not be increasing linearly.
Use pol2cart() to switch between an (r, theta) form vs (x,y) coordinates.

댓글 수: 3

James
James 2013년 8월 21일
I did try that but this is the result As you can see there is no full circle there. Maybe that's a mistake with my data or something else. May be its right and I just need to trim the curves.
Anyways, thank you for your time and help. I really appreciate it.
I see a circle and two spirals. Is this what you're looking for?
theta = linspace(pi/2+2*pi, pi/2, 100);
r = cell(3,1);
r{1} = ones(size(theta)); % The circle
r{2} = linspace(1, 0.5, 60); % Spiral in
r{3} = linspace(1, 1.5, 60); % Spiral out
for ii = 1:3
[x{ii}, y{ii}] = pol2cart(theta(1:length(r{ii})), r{ii});
end
xy = [x;y]; plot(xy{:}); axis equal;
James
James 2013년 8월 21일
@Kelly Kearney: Thank you. That works perfect.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Image Analyst
Image Analyst 2013년 8월 21일

1 개 추천

You say "I have the data for them" so why don't you just use the plot() function and plot them? Am I missing something???

댓글 수: 1

James
James 2013년 8월 21일
편집: James 2013년 8월 21일
I have cropped the curve and that does make it better but I cannot get it to plot the full circle. I tried using a circle function for the circle but that failed too. Here is my code:
vehicle.a = 1.4; vehicle.b = 1.6; vehicle.m = 1600; vehicle.k = 1.5;
vehicle.l = vehicle.a + vehicle.b; vehicle.I = vehicle.m*vehicle.k^2;
vehicle.Cf = 6e4; vehicle.Cr = 6e4; vehicle.Ct = vehicle.Cf + vehicle.Cr;
% steering characteristics of the vehicle
steer.u = 1:1:40;
steer.a = [1.4 1.5 1.6]; steer.b = [1.6 1.5 1.4];
for i = 1:3
loop.a = steer.a(i);
loop.b = steer.b(i);
steer.s (:,i) = (loop.a*vehicle.Cf - loop.b*vehicle.Cr)/vehicle.Ct;
end
% Relations of turn radius and vehicle speed for constant steer angle
steer.delta = degtorad (3);
for j = 1:3
loop.s = steer.s(j);
for i = 1:40
loop.Vx = steer.u(i);
steer.R(i,j) = (vehicle.l/steer.delta)*(1-(((vehicle.Ct*loop.s*vehicle.m)/(2*vehicle.l^2*vehicle.Cf*vehicle.Cr))*loop.Vx^2));
end
end
% Change in turn radius with vehivle speed
loop.R = 50;
for j = 1:3
loop.s = steer.s(j);
for i = 1:40
loop.Vx = steer.u(i);
steer.delta(i,j) = (vehicle.l/loop.R)*(1-(((vehicle.Ct*loop.s*vehicle.m)/(2*vehicle.l^2*vehicle.Cf*vehicle.Cr))*loop.Vx^2));
end
end
for i = 1:3
steer.r = abs(steer.delta(:,i));
[loop.r,loop.theta] = spiral(steer.r);
steer.radius(:,i) = loop.r(:,1);
steer.theta(:,i) = loop.theta(:,1);
end
%Change of turning with increase of vehicle speed.
figure (4)
hold on
plot(steer.radius(:,1),steer.theta(:,1),'r')
plot(steer.radius(:,2),steer.theta(:,2),'b')
plot(steer.radius(:,3),steer.theta(:,3),'g')
title('Change of turning with increase of vehicle speed')
axis('equal')
hold off
The code is not yet cleaned up but that is no problem. Thank you for for taking such an interest in helping me.

댓글을 달려면 로그인하십시오.

David Sanchez
David Sanchez 2013년 8월 21일

0 개 추천

Try this out:
[x,y] = meshgrid(1:150,1:100);
[th, rho] = cart2pol(x - 75,y - 50); % convert to polar
% spiral centered at (75,50)
Img = sin(r/3 + th);
imagesc(Img); colormap(hot);
axis equal; axis off;

댓글 수: 1

James
James 2013년 8월 21일
Thank you for your help, but I am not looking to plot a spiral. I wanted to plot a curve with the radius increasing from a fixed distance.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by