?
Solved

Get x axis value at point matlab

Posted on 2010-11-17
4
Medium Priority
?
986 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

777 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