MATLAB Answers

Zero points on graph

26 ビュー (過去 30 日間)
Stefan Juhanson
Stefan Juhanson 2021 年 4 月 18 日 17:05
編集済み: Matt J 2021 年 4 月 18 日 23:14
I need to find the 0 points of 2 lineral equations and save them. I can get the point where x = 0 manually from basic fitting and the other one i cant get at all. Is there a way to get from the y = p1 + p2, the p2 out somehow?
And then i need the point where y = 0 the x value. I dont even know the name of that point in english so its hard to search it for me.
heres my code:
format shortE
A = load('*******')
A(:,1) = []
A(1:101,:) = []
A
x = A(1:end,1);
y = A(1:end,2);
n1 = A([25:29],1)
m1 = A([25:29],2)
TL1 = polyfit(n1,m1,1);
d1 = polyval(TL1,x);
plot(x,d1)
hold on
plot(n1,m1,'.')
hold on
n2 = A([53:58],1)
m2 = A([53:58],2)
plot(n2,m2,'.')
hold on
TL2 = polyfit(n2,m2,1);
d2 = polyval(TL2,x);
plot(x,d2)
hold off
The first lines i just take some values from a larger matrix. Then i make linear trendlines where the lines cross the x = 0 and y = 0. But i need to save those values automatically. I.E for the yellow line "x = 0 then give value of y" and from the purple line "y = 0 then give value of x".

採用された回答

Matt J
Matt J 2021 年 4 月 18 日 23:03
編集済み: Matt J 2021 年 4 月 18 日 23:14
xIntercept1=roots(TL1);
xintercept2=roots(TL2);
yIntercept1=polyval(TL1,0);
yIntercept2=polyval(TL2,0);

その他の回答 (0 件)

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by