Intersection between line and function

14 ビュー (過去 30 日間)
ourimchi omar
ourimchi omar 2018 年 8 月 3 日
編集済み: jonas 2018 年 8 月 3 日
hello i draw graphics on matlab based on data found in tables, and what i'm trying to do is project a Y value and find its equivalent X, i give you the code used to create the projection Y, as well as the graph
xlim([0,50])
YV = [min(X1)-0.1:0.01:max(X1)+0.1];
XVmax = zeros(1,numel(YV));
j = [1:numel(YV)];
XVmax(j)= max(Y2_max);
plot(YV,XVmax,'--m')

回答 (1 件)

jonas
jonas 2018 年 8 月 3 日
編集済み: jonas 2018 年 8 月 3 日
Use InterX from fileexchange for high accuracy even with low resolution data. Example:
%%Some data
x=0:.9:20;
y=x.^2
%%Set threshold
t=200;
yt=[t t]
xt=[min(x),max(x)];
P=InterX([xt;yt],[x;y])
h=plot(x,y,'+-k',...
xt,yt,'r',...
P(1),P(2),'bo')
set(h(3),'markerfacecolor',[1 0 0])
Note that the resolution of the x-range is quite poor, yet the intercep is accurate.

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by