Prev: svm_v0.55 compile MEX error
Next: Notch filter
From: Niall Heavey on 30 Jun 2010 10:42 Hi all, I am looking to plot a straight forward curve. I thought it would be simple enough to do but I can't find anything to help me so far. Basically I want a curve from point 1 to point 3 that goes through point 2. Sounds simple enough but does anyone know a function available for it? Thanks in advance.
From: John D'Errico on 30 Jun 2010 11:27 "Niall Heavey" <REMOVEniallALLheaveyCAPLOCKS(a)gmail.com> wrote in message <i0fl3s$aqc$1(a)fred.mathworks.com>... > Hi all, I am looking to plot a straight forward curve. > I thought it would be simple enough to do but I can't find anything to help me so far. > > Basically I want a curve from point 1 to point 3 that goes through point 2. > > Sounds simple enough but does anyone know a function available for it? > > Thanks in advance. There are infinitely many such curves. The simplest is a piecewise linear curve, i.e., connect the dots. Plot can do it for you. If you want a better answer than that, you need to tell us, is this in two dimensions? Or 3 or more? Must the curve be smooth? Is this a single valued relationship, or does the curve wrap around? John
From: Roger Stafford on 30 Jun 2010 11:43 "Niall Heavey" <REMOVEniallALLheaveyCAPLOCKS(a)gmail.com> wrote in message <i0fl3s$aqc$1(a)fred.mathworks.com>... > Hi all, I am looking to plot a straight forward curve. > I thought it would be simple enough to do but I can't find anything to help me so far. > > Basically I want a curve from point 1 to point 3 that goes through point 2. > > Sounds simple enough but does anyone know a function available for it? > > Thanks in advance. - - - - - - - As John says, there are infinitely many possible ways. For example, if you want a second order polynomial in 2-space - 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 y = c2*x^2 + c1*x + c0 the three coefficients can be determined from c = [x.^2,x,ones(3,1)]\y; where x = [x1;x2;x3], y = [y1;y2;y3], and c = [c2;c1;c0]. Roger Stafford
From: Niall Heavey on 30 Jun 2010 11:54 "John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <i0fno8$60j$1(a)fred.mathworks.com>... > "Niall Heavey" <REMOVEniallALLheaveyCAPLOCKS(a)gmail.com> wrote in message <i0fl3s$aqc$1(a)fred.mathworks.com>... > > Hi all, I am looking to plot a straight forward curve. > > I thought it would be simple enough to do but I can't find anything to help me so far. > > > > Basically I want a curve from point 1 to point 3 that goes through point 2. > > > > Sounds simple enough but does anyone know a function available for it? > > > > Thanks in advance. > > There are infinitely many such curves. > > The simplest is a piecewise linear curve, i.e., connect the dots. > Plot can do it for you. > > If you want a better answer than that, you need to tell us, is > this in two dimensions? Or 3 or more? Must the curve be smooth? > Is this a single valued relationship, or does the curve wrap around? > > John Its two dimensions, it would be better if it is smooth. I'd say the easiest way to explain it would be to send the code: radius = 10; plot(0,0,'b*') hold on i = 4; for j = 1:i*2 t = linspace(0,2*pi,(i*2)+1); t = linspace(-(t(2)/2),((2*pi)-(t(2)/2)),(i*2)+1); r = radius; A = r*cos(t); B = r*sin(t); plot(A(j),B(j),'b*') % axis ([-25 25 -25 25]) % axis square % % text(a(j),b(j),strcat(' User ',num2str(j))) end for j = 1:i t = linspace(0,2*pi,i+1); r = radius*2; a = r*cos(t); b = r*sin(t); plot(a(j),b(j),'g*') axis ([-25 25 -25 25]) axis square text(a(j),b(j),strcat(' User ',num2str(j))) end 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. Hope that makes more sense! Thanks
|
Pages: 1 Prev: svm_v0.55 compile MEX error Next: Notch filter |