http://www.mathworks.com/matlabcentral/newsreader/view_thread/285857
MATLAB Central Newsreader  Curve
Feed for thread: Curve
enus
©19942015 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Wed, 30 Jun 2010 14:42:04 +0000
Curve
http://www.mathworks.com/matlabcentral/newsreader/view_thread/285857#758837
Niall Heavey
Hi all, I am looking to plot a straight forward curve.<br>
I thought it would be simple enough to do but I can't find anything to help me so far.<br>
<br>
Basically I want a curve from point 1 to point 3 that goes through point 2.<br>
<br>
Sounds simple enough but does anyone know a function available for it?<br>
<br>
Thanks in advance.

Wed, 30 Jun 2010 15:27:04 +0000
Re: Curve
http://www.mathworks.com/matlabcentral/newsreader/view_thread/285857#758848
John D'Errico
"Niall Heavey" <REMOVEniallALLheaveyCAPLOCKS@gmail.com> wrote in message <i0fl3s$aqc$1@fred.mathworks.com>...<br>
> Hi all, I am looking to plot a straight forward curve.<br>
> I thought it would be simple enough to do but I can't find anything to help me so far.<br>
> <br>
> Basically I want a curve from point 1 to point 3 that goes through point 2.<br>
> <br>
> Sounds simple enough but does anyone know a function available for it?<br>
> <br>
> Thanks in advance.<br>
<br>
There are infinitely many such curves.<br>
<br>
The simplest is a piecewise linear curve, i.e., connect the dots.<br>
Plot can do it for you.<br>
<br>
If you want a better answer than that, you need to tell us, is<br>
this in two dimensions? Or 3 or more? Must the curve be smooth?<br>
Is this a single valued relationship, or does the curve wrap around?<br>
<br>
John

Wed, 30 Jun 2010 15:43:04 +0000
Re: Curve
http://www.mathworks.com/matlabcentral/newsreader/view_thread/285857#758854
Roger Stafford
"Niall Heavey" <REMOVEniallALLheaveyCAPLOCKS@gmail.com> wrote in message <i0fl3s$aqc$1@fred.mathworks.com>...<br>
> Hi all, I am looking to plot a straight forward curve.<br>
> I thought it would be simple enough to do but I can't find anything to help me so far.<br>
> <br>
> Basically I want a curve from point 1 to point 3 that goes through point 2.<br>
> <br>
> Sounds simple enough but does anyone know a function available for it?<br>
> <br>
> Thanks in advance.<br>
       <br>
As John says, there are infinitely many possible ways. For example, if you want a second order polynomial in 2space  a quadratic function  to go through the three points, let the points be (x1,y1), (x2,y2), and (x3,y3). If the polynomial is expressed in the form<br>
<br>
y = c2*x^2 + c1*x + c0<br>
<br>
the three coefficients can be determined from<br>
<br>
c = [x.^2,x,ones(3,1)]\y;<br>
<br>
where x = [x1;x2;x3], y = [y1;y2;y3], and c = [c2;c1;c0].<br>
<br>
Roger Stafford

Wed, 30 Jun 2010 15:54:04 +0000
Re: Curve
http://www.mathworks.com/matlabcentral/newsreader/view_thread/285857#758859
Niall Heavey
"John D'Errico" <woodchips@rochester.rr.com> wrote in message <i0fno8$60j$1@fred.mathworks.com>...<br>
> "Niall Heavey" <REMOVEniallALLheaveyCAPLOCKS@gmail.com> wrote in message <i0fl3s$aqc$1@fred.mathworks.com>...<br>
> > Hi all, I am looking to plot a straight forward curve.<br>
> > I thought it would be simple enough to do but I can't find anything to help me so far.<br>
> > <br>
> > Basically I want a curve from point 1 to point 3 that goes through point 2.<br>
> > <br>
> > Sounds simple enough but does anyone know a function available for it?<br>
> > <br>
> > Thanks in advance.<br>
> <br>
> There are infinitely many such curves.<br>
> <br>
> The simplest is a piecewise linear curve, i.e., connect the dots.<br>
> Plot can do it for you.<br>
> <br>
> If you want a better answer than that, you need to tell us, is<br>
> this in two dimensions? Or 3 or more? Must the curve be smooth?<br>
> Is this a single valued relationship, or does the curve wrap around?<br>
> <br>
> John<br>
<br>
Its two dimensions, it would be better if it is smooth.<br>
<br>
I'd say the easiest way to explain it would be to send the code:<br>
<br>
radius = 10;<br>
plot(0,0,'b*')<br>
hold on<br>
i = 4;<br>
<br>
for j = 1:i*2<br>
t = linspace(0,2*pi,(i*2)+1);<br>
t = linspace((t(2)/2),((2*pi)(t(2)/2)),(i*2)+1);<br>
r = radius;<br>
A = r*cos(t);<br>
B = r*sin(t);<br>
plot(A(j),B(j),'b*')<br>
<br>
% axis ([25 25 25 25])<br>
% axis square<br>
% % text(a(j),b(j),strcat(' User ',num2str(j)))<br>
end<br>
<br>
for j = 1:i<br>
t = linspace(0,2*pi,i+1);<br>
r = radius*2;<br>
a = r*cos(t);<br>
b = r*sin(t);<br>
plot(a(j),b(j),'g*')<br>
<br>
axis ([25 25 25 25])<br>
axis square<br>
text(a(j),b(j),strcat(' User ',num2str(j)))<br>
end<br>
<br>
So basically what i'm trying to do is create a link between the center point and user 1, this would be going through both point A(1),B(1) and A(2),B(2), then the link to user 2 form the center would go through A(3),B(3) and A(4),B(4) and so on.<br>
<br>
Hope that makes more sense!<br>
<br>
Thanks