Solved

Get x axis value at point matlab

Posted on 2010-11-17
4
980 Views
Last Modified: 2016-03-02
Hello all,
I am trying to plot a circle at the min point of a plot. I am able to find the Y min value, however, I am trying to find the value of the X-axis at this point.

Thank you
clear all;
R=1600;
L=120e-6;
C=100e-9;

num = [R*L*C 0 R];
den = [R*L*C L R];

subplot(2,1,1)

system=tf(num,den);
[mag,phase]=bode(system,{2.8e5,3e5});

mag=db(mag);
[minvalue,minIndex]=min(mag);


hold on;
bodemag(system,{2.8e5,3e5});
title('Bode plot for question 1');
plot(??,minvalue,'mo');

subplot(2,1,2);
h=bodeplot(system,{2.8e5,3e5});
setoptions(h,'MagVisible','off');
title('');
hold off;

Open in new window

0
Comment
Question by:dwb178
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 15

Accepted Solution

by:
yuk99 earned 500 total points
ID: 34161314
Use second output argument of MIN function to get index of the point at minimum:

[ymin, idx] = min(y);
xmin = x(idx);
0
 
LVL 1

Author Comment

by:dwb178
ID: 34161458
Hello yuk99,
Thanks for the reply. I tried that and keep getting error message:

??? Undefined function or method 'x' for input arguments of type 'double'.
0
 
LVL 15

Expert Comment

by:yuk99
ID: 34161544
How do you create the plot? What is x and y variables. In my example I used variable x as x coordinates and y as y coordinates. If you use different variables, use yours instead. Show your code to draw plot if you still have problems.
0
 
LVL 15

Expert Comment

by:yuk99
ID: 34327984
Sorry, I read the question on my smartphone and didn't see the code. So my accepted answer doesn't actually answer the question.

Here is another answer that should work in case you don't know x and y of your plot, but want to show minimum point on the plot::

hold on
bodemag(system,{2.8e5,3e5});
h = findobj(gca,'type','line');
for ii=1:numel(h);
    x = get(h(ii),'XData');
    if numel(x)==0 || any(isnan(x))
        continue
    end
    y = get(h(ii),'YData');
    break
end
[minValue,minIndex]=min(y);

plot(x(minIndex),minValue,'mo');
hold off

Open in new window

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to implement Singleton Design Pattern in Java.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question