Re: Intersect problem
- From: "Adrian Cherry" <acherry@xxxxxxxxxxxxxx>
- Date: 22 May 2007 10:25:45 +0100
Derek <derek_ooi2003@xxxxxxxxxxx> wrote in
news:ef57b1a.-1@xxxxxxxxxxxxxxxxxxxxxxx:
I wanted to find the intersect of 2 graphs
My first graph is generated from the points inside a text
file. I had no problem generating the graph.
______________________________________________________
data = load('table1.txt'); %load data from equipment
current = data(:, 1); %current
voltage = data(:, 2); %voltage
a=plot(voltage,current)
hold on
_______________________________________________________
My second graph is generated from an equation 'y=mx'. No
problem generating the graph also.
_______________________________________________________
V=0:1:12;
I=V/0.1;
b=plot(V,I)
________________________________________________________
However problem arise when i want to intersect both graphs.
I insert intersect(a,b) to find the intersection, but no
values are produced. I check the 2 graphs and the 2 graphs 2
intersect at 1 point. Can any1 point out where my problems
are Thx.
I think the problem is that intersect is not doing what you think
it does, the function name is misleading in my opinion. It does
not calculate the intersection between 2 lines but "returns the
values common to both A and B". So your voltage would have to be
exactly 6.0 and current exactly 60.0 to get an intersection
point.
Look on Matlab central for curveintersect, This may well do what
you require. I've not used it as I've written my own little
utility to a calculate line intersection.
Hope this helps
Adrian
.
- Follow-Ups:
- Re: Intersect problem
- From: John D'Errico
- Re: Intersect problem
- References:
- Intersect problem
- From: Derek
- Intersect problem
- Prev by Date: Re: Callbacks from Java components...
- Next by Date: Generate and execute P-file
- Previous by thread: Re: Intersect problem
- Next by thread: Re: Intersect problem
- Index(es):
Relevant Pages
|
Loading