Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Ploting Tangent Line

Subject: Ploting Tangent Line

From: Model Ramachandran

Date: 26 Dec, 2008 03:22:03

Message: 1 of 8

Hi Friends,

I would like to plot Tangent Line in MATLAB.

In my graph I would like to PLOT A TANGENT LINE & That Tangent Line intersect point in X-Axis.

Which Command I have to use...?

Kindly help me..

Thanks in advance

With Regards
Selvakumar.R

Subject: Ploting Tangent Line

From: ImageAnalyst

Date: 26 Dec, 2008 04:44:42

Message: 2 of 8

On Dec 25, 10:22=A0pm, "Model Ramachandran" <selvakumar....@gmail.com>
wrote:
> Hi Friends,
>
> I would like to plot Tangent Line in MATLAB.
>
> In my graph I would like to PLOT A TANGENT LINE & That Tangent Line inter=
sect point in X-Axis.
>
> Which Command I have to use...?
>
> Kindly help me..
>
> Thanks in advance
>
> With Regards
> Selvakumar.R

--------------------------------------------------
The plot() function comes to mind.

Subject: Ploting Tangent Line

From: Model Ramachandran

Date: 26 Dec, 2008 04:58:02

Message: 3 of 8

plot(x,tan(x));will plot the tangent line,But I would like to find out the tangent line intersect point at X- axis .( value of X-Axis point)

Thanks

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <33800a5a-98b8-4e43-8940-67aab83cb319@v38g2000yqb.googlegroups.com>...
> On Dec 25, 10:22=A0pm, "Model Ramachandran" <selvakumar....@gmail.com>
> wrote:
> > Hi Friends,
> >
> > I would like to plot Tangent Line in MATLAB.
> >
> > In my graph I would like to PLOT A TANGENT LINE & That Tangent Line inter=
> sect point in X-Axis.
> >
> > Which Command I have to use...?
> >
> > Kindly help me..
> >
> > Thanks in advance
> >
> > With Regards
> > Selvakumar.R
>
> --------------------------------------------------
> The plot() function comes to mind.

Subject: Ploting Tangent Line

From: Model Ramachandran

Date: 26 Dec, 2008 05:54:01

Message: 4 of 8

plot(x,tan(x));will plot the tangent line,But I would like to find out the tangent line intersect point at X- axis .( value of X-Axis point)

Thanks

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <33800a5a-98b8-4e43-8940-67aab83cb319@v38g2000yqb.googlegroups.com>...
> On Dec 25, 10:22=A0pm, "Model Ramachandran" <selvakumar....@gmail.com>
> wrote:
> > Hi Friends,
> >
> > I would like to plot Tangent Line in MATLAB.
> >
> > In my graph I would like to PLOT A TANGENT LINE & That Tangent Line inter=
> sect point in X-Axis.
> >
> > Which Command I have to use...?
> >
> > Kindly help me..
> >
> > Thanks in advance
> >
> > With Regards
> > Selvakumar.R
>
> --------------------------------------------------
> The plot() function comes to mind.

Subject: Ploting Tangent Line

From: Roger Stafford

Date: 26 Dec, 2008 05:55:03

Message: 5 of 8

"Model Ramachandran" <selvakumar.ram@gmail.com> wrote in message <gj1ikr$nii$1@fred.mathworks.com>...
> ......
> I would like to plot Tangent Line in MATLAB.
> In my graph I would like to PLOT A TANGENT LINE & That Tangent Line intersect point in X-Axis.
> .......

  I presume you have a graph which can be expressed as a function y = f(x) and you wish to draw a line which is tangent at a point somewhere on this graph and which runs through a given point (x0,y0). (I believe you stated the latter point was actually on the x-axis which would make y0 equal to 0.)

  The hard part of doing this is locating the point of tangency (x1,y1). It will have to satisfy the equation

 f'(x1) = (f(x1)-y0)/(x1-x0)

where f'(x) refers to the derivative of f(x), and this might be difficult to solve or approximate. If necessary you might have to use 'fzero' or something like the Newton-Raphson method to do this, or perhaps there exists a solution that can be found using the Symbolic Toolbox function 'solve'. (As a last desperate attempt, even work with a pen and paper might do the job.)

  After succeeding with this, doing the plot is a very much simpler problem: plot the line connecting the two points (x1,f(x1)) and (x0,y0).

 x = linspace(x0,x1);
 y1 = f(x1);
 y = ((y1-y0)*x+y0*x1-y1*x0)/(x1-x0);
 plot(x,y)

Roger Stafford

Subject: Ploting Tangent Line

From: Model Ramachandran

Date: 26 Dec, 2008 08:05:05

Message: 6 of 8

Hi Thanks for your reply,

its not too complex like mentioning funtion all those things...

the problem : in my graph I know the maximum value of Y-Axis point .
At which X axis value Y value is maximum (X=Y(MAX)), So I need to draw the tangent line at maximum Y (i.e Y max forparticular X value).

This tangent Line Intersects at some point in X-Axis.I have to find out that value

Stil I am trying


"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <gj1rjn$mbg$1@fred.mathworks.com>...
> "Model Ramachandran" <selvakumar.ram@gmail.com> wrote in message <gj1ikr$nii$1@fred.mathworks.com>...
> > ......
> > I would like to plot Tangent Line in MATLAB.
> > In my graph I would like to PLOT A TANGENT LINE & That Tangent Line intersect point in X-Axis.
> > .......
>
> I presume you have a graph which can be expressed as a function y = f(x) and you wish to draw a line which is tangent at a point somewhere on this graph and which runs through a given point (x0,y0). (I believe you stated the latter point was actually on the x-axis which would make y0 equal to 0.)
>
> The hard part of doing this is locating the point of tangency (x1,y1). It will have to satisfy the equation
>
> f'(x1) = (f(x1)-y0)/(x1-x0)
>
> where f'(x) refers to the derivative of f(x), and this might be difficult to solve or approximate. If necessary you might have to use 'fzero' or something like the Newton-Raphson method to do this, or perhaps there exists a solution that can be found using the Symbolic Toolbox function 'solve'. (As a last desperate attempt, even work with a pen and paper might do the job.)
>
> After succeeding with this, doing the plot is a very much simpler problem: plot the line connecting the two points (x1,f(x1)) and (x0,y0).
>
> x = linspace(x0,x1);
> y1 = f(x1);
> y = ((y1-y0)*x+y0*x1-y1*x0)/(x1-x0);
> plot(x,y)
>
> Roger Stafford

Subject: Ploting Tangent Line

From: Roger Stafford

Date: 26 Dec, 2008 17:28:02

Message: 7 of 8

"Model Ramachandran" <selvakumar.ram@gmail.com> wrote in message <gj237h$chv$1@fred.mathworks.com>...
> ........
> the problem : in my graph I know the maximum value of Y-Axis point .
> At which X axis value Y value is maximum (X=Y(MAX)), So I need to draw the tangent line at maximum Y (i.e Y max forparticular X value).
> This tangent Line Intersects at some point in X-Axis.I have to find out that value
> Stil I am trying

  A line tangent to your graph at its point of maximum y-value would have to be a horizontal line that would never intersect the x-axis unless it were the x-axis itself. In any case, that way there could never be a unique point of intersection with the x-axis. Stated differently, to have a unique solution to the equation I mentioned, the derivative, f'(x1), must be non-zero, which is incompatible with f(x1) being a point of maximum value of f(x). You must look for something other than the maximum point on your graph in your search for the desired point of tangency.

  When you say "tangent line" is it possible you mean something other than a line tangent to the graph? Are you possibly talking about the "tangent" function in some sense? That would be an entirely different matter.

Roger Stafford

Subject: Ploting Tangent Line

From: ImageAnalyst

Date: 26 Dec, 2008 18:12:17

Message: 8 of 8

On Dec 26, 12:28=A0pm, "Roger Stafford"
<ellieandrogerxy...@mindspring.com.invalid> wrote:
> "Model Ramachandran" <selvakumar....@gmail.com> wrote in message <gj237h$=
ch...@fred.mathworks.com>...
> > ........
> > the problem : in =A0my graph I know the maximum value of Y-Axis point .
> > At which X axis value =A0Y value is maximum (X=3DY(MAX)), So I need to =
draw the tangent line at maximum Y (i.e Y max forparticular X value).
> > This tangent Line Intersects at some point in X-Axis.I have to find out=
 that value
> > Stil I am trying
>
> =A0 A line tangent to your graph at its point of maximum y-value would ha=
ve to be a horizontal line that would never intersect the x-axis unless it =
were the x-axis itself. =A0In any case, that way there could never be a uni=
que point of intersection with the x-axis. =A0Stated differently, to have a=
 unique solution to the equation I mentioned, the derivative, f'(x1), must =
be non-zero, which is incompatible with f(x1) being a point of maximum valu=
e of f(x). =A0You must look for something other than the maximum point on y=
our graph in your search for the desired point of tangency.
>
> =A0 When you say "tangent line" is it possible you mean something other t=
han a line tangent to the graph? =A0Are you possibly talking about the "tan=
gent" function in some sense? =A0That would be an entirely different matter=
.
>
> Roger Stafford

---------------------------------------------------------
Yeah, this guy is so confused about what he wants, and in the
terminology he uses that no one knows what the heck he wants, probably
not even him. You see an earlier post he mentioned that "plot(x,tan
(x));" will plot 'the tangent line." First of all, since the tangent
is not a line, I think he really meant tangent curve. So Roger is
right, this is an entirely different concept. Secondly, if he wants
to know where the tangent curve intersects the y axis, just plug in 0
for x and you'll get the answer! It intersects the y axis at zero, as
any trig book or web search will illustrate. I mean it's SO obvious
that any 10th grader would know, so that leads us back to the
possibility that he just can't formulate a question to state what he
really wants.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us