Retrieve the coordinates of the point from the graph

3 Ansichten (letzte 30 Tage)
Stanislav Kuba
Stanislav Kuba am 21 Dez. 2022
Bearbeitet: Bora Eryilmaz am 21 Dez. 2022
I have such a problem and can't see myself continuing.
I have been given such an assignment and at the end I can't continue on my own.
I have a graph and from the graph I have to read the coordinates of the point where 2 lines intersect and I have to save them in
variables xm and ym. I would like to ask if someone could help me.
this is my work:
V1 = [-1 0 0 -2];
x = roots(V1);
x1= x(1,1);
x2= x(2,1);
x3= x(3,1);
R1=x1*2;
R2=x3*x2;
V2= poly([R1 R2]);
M1= [V1(1,1) V1(1,2) V1(1,3) V1(1,4) ; 1 2 3 4];
M2= [V2(1,1) V2(1,2);1 2;3 4;5 6];
M3 = M1.*M2';
max3=max(M3, [], 'all');
min3=min(M3, [],'all');
rozdiel=min3-max3;
if rozdiel<100
min3=abs(min3);
krok=floor(min3);
A=linspace(min(M2(:,1)),max(M1(2,:)),krok);
Acos=(cos(A)).^2;
B=linspace(min(M1(2,:)),max(M2(:,1)),krok);
Bsin=sin(B).^8;
t=linspace(1,100,krok);
figure
hold on
title('Graf uloha 9','FontSize',15,'Color','Blue')
xlabel('cas \rightarrow')
ylabel('hodnota \rightarrow')
plot(Acos,t, 'color', 'Blue')
plot(Bsin,t, 'color', 'Yellow')
end

Antworten (1)

Bora Eryilmaz
Bora Eryilmaz am 21 Dez. 2022
Bearbeitet: Bora Eryilmaz am 21 Dez. 2022
If you want to do it manually on the plot by clicking with the mouse at or near the intersections, and get their coordinates, you can use the ginput command: https://www.mathworks.com/help/matlab/ref/ginput.html

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by